From 781397f8a4f513e4c9021b4e6b8842ac88ee431d Mon Sep 17 00:00:00 2001 From: Tetsuya Mori Date: Mon, 7 Jan 2019 13:54:41 +0900 Subject: [PATCH 01/26] 3.0.0-pre.7 with [WIP][test] Issue #60 Add test/preprocess3 --- package.json | 2 +- test/index.html | 4 +- .../basic-test-dom-bind-dummy.html | 570 ++++++++ test/preprocess3/basic-test-imports.js | 29 + test/preprocess3/basic-test-suites.js | 1299 +++++++++++++++++ test/preprocess3/basic-test.html | 303 ++++ .../commented-simple-text-element.js | 435 ++++++ .../commented-simple-text-element.json | 41 + .../commented-simple-text-element.fr.json | 43 + .../compound-binding-dom-bind.json | 151 ++ .../compound-binding-element.js | 791 ++++++++++ .../compound-binding-element.json | 151 ++ .../locales/compound-binding-element.fr.json | 153 ++ test/preprocess3/edge-case-dom-bind.json | 29 + test/preprocess3/edge-case-test-imports.js | 25 + test/preprocess3/edge-case-test-suites.js | 411 ++++++ test/preprocess3/edge-case-test.html | 121 ++ .../edge-case/advanced-binding-element.js | 541 +++++++ .../edge-case/advanced-binding-element.json | 36 + .../complex-compound-binding-element.js | 582 ++++++++ .../complex-compound-binding-element.json | 69 + test/preprocess3/edge-case/empty-element.js | 106 ++ test/preprocess3/edge-case/empty-element.json | 4 + .../locales/advanced-binding-element.fr.json | 38 + .../complex-compound-binding-element.fr.json | 71 + .../edge-case/locales/empty-element.fr.json | 6 + .../edge-case/no-template-element.js | 58 + test/preprocess3/fake-server.js | 45 + .../fallback-text-element.js | 413 ++++++ .../fallback-text-element.json | 41 + .../locales/fallback-text-element.fr-CA.json | 114 ++ .../locales/fallback-text-element.fr.json | 89 ++ .../locales/compound-binding-dom-bind.fr.json | 153 ++ .../locales/simple-attribute-dom-bind.fr.json | 146 ++ .../locales/simple-text-dom-bind.fr.json | 43 + .../preprocess3/multiple-case-test-imports.js | 22 + test/preprocess3/multiple-case-test-suites.js | 47 + test/preprocess3/multiple-case-test.html | 31 + .../preprocess3/multiple-case/item-element.js | 110 ++ .../multiple-case/item-element.json | 5 + .../locales/item-element.fr.json | 7 + .../locales/multiple-element.fr.json | 6 + .../multiple-case/multiple-element.js | 365 +++++ .../multiple-case/multiple-element.json | 4 + test/preprocess3/no-persist-test-imports.js | 22 + test/preprocess3/no-persist-test-suites.js | 64 + test/preprocess3/no-persist-test.html | 39 + .../locales/plural-gender-element.fr.json | 27 + .../plural-gender-element.js | 364 +++++ .../plural-gender-element.json | 25 + test/preprocess3/preference-test-imports.js | 22 + test/preprocess3/preference-test-suites.js | 46 + test/preprocess3/preference-test.html | 33 + .../preference/preference-element.js | 173 +++ .../preference/preference-element.json | 4 + .../simple-attribute-dom-bind.json | 144 ++ .../locales/simple-attribute-element.fr.json | 146 ++ .../locales/text-attribute-element.fr.json | 7 + .../simple-attribute-element.js | 957 ++++++++++++ .../simple-attribute-element.json | 144 ++ .../text-attribute-element.js | 321 ++++ .../text-attribute-element.json | 5 + test/preprocess3/simple-text-dom-bind.json | 41 + .../locales/simple-text-element.fr.json | 43 + .../locales/simple-text-element.ru.json | 43 + .../simple-text-element.js | 413 ++++++ .../simple-text-element.json | 41 + .../locales/simple-text-id-element.fr.json | 49 + .../simple-text-id-element.js | 410 ++++++ .../simple-text-id-element.json | 47 + .../template-default-lang-test-imports.js | 23 + .../template-default-lang-test-suites.js | 325 +++++ .../template-default-lang-test.html | 37 + ...plate-default-lang-element.zh-Hans-CN.json | 43 + ...plate-default-lang-element.zh-Hans-CN.json | 43 + .../null-template-default-lang-element.js | 409 ++++++ .../null-template-default-lang-element.json | 41 + .../template-default-lang-element.js | 409 ++++++ .../template-default-lang-element.json | 41 + test/preprocess3/test-runner.js | 721 +++++++++ test/src3/basic-test-dom-bind-dummy.html | 315 ++++ test/tmp/basic-test-dom-bind-dummy.html | 570 ++++++++ test/tmp/basic-test.html | 303 ++++ .../commented-simple-text-element.html | 173 +++ .../commented-simple-text-element.json | 41 + test/tmp/compound-binding-dom-bind.json | 151 ++ .../compound-binding-element.html | 380 +++++ .../compound-binding-element.json | 151 ++ test/tmp/edge-case-dom-bind.json | 29 + test/tmp/edge-case-test.html | 121 ++ .../edge-case/advanced-binding-element.html | 126 ++ .../edge-case/advanced-binding-element.json | 36 + .../complex-compound-binding-element.html | 236 +++ .../complex-compound-binding-element.json | 69 + test/tmp/edge-case/empty-element.html | 21 + test/tmp/edge-case/empty-element.json | 4 + .../fallback-text-element.html | 160 ++ .../fallback-text-element.json | 41 + test/tmp/i18n-attr-repo.html | 20 + test/tmp/i18n-attr-repo.js | 520 +++++++ test/tmp/multiple-case-test.html | 31 + test/tmp/multiple-case/item-element.html | 24 + test/tmp/multiple-case/item-element.json | 5 + test/tmp/multiple-case/multiple-element.html | 36 + test/tmp/multiple-case/multiple-element.json | 4 + test/tmp/no-persist-test.html | 39 + .../plural-gender-element.html | 82 ++ .../plural-gender-element.json | 25 + test/tmp/preference-test.html | 33 + test/tmp/preference/preference-element.html | 22 + test/tmp/preference/preference-element.json | 4 + test/tmp/simple-attribute-dom-bind.json | 144 ++ .../simple-attribute-element.html | 394 +++++ .../simple-attribute-element.json | 144 ++ .../text-attribute-element.html | 79 + .../text-attribute-element.json | 5 + test/tmp/simple-text-dom-bind.json | 41 + .../simple-text-element.html | 160 ++ .../simple-text-element.json | 41 + .../simple-text-id-element.html | 158 ++ .../simple-text-id-element.json | 47 + test/tmp/template-default-lang-test.html | 37 + .../null-template-default-lang-element.html | 160 ++ .../null-template-default-lang-element.json | 41 + .../template-default-lang-element.html | 160 ++ .../template-default-lang-element.json | 41 + 126 files changed, 18853 insertions(+), 3 deletions(-) create mode 100644 test/preprocess3/basic-test-dom-bind-dummy.html create mode 100644 test/preprocess3/basic-test-imports.js create mode 100644 test/preprocess3/basic-test-suites.js create mode 100644 test/preprocess3/basic-test.html create mode 100644 test/preprocess3/commented-simple-text-element/commented-simple-text-element.js create mode 100644 test/preprocess3/commented-simple-text-element/commented-simple-text-element.json create mode 100755 test/preprocess3/commented-simple-text-element/locales/commented-simple-text-element.fr.json create mode 100644 test/preprocess3/compound-binding-dom-bind.json create mode 100644 test/preprocess3/compound-binding-element/compound-binding-element.js create mode 100644 test/preprocess3/compound-binding-element/compound-binding-element.json create mode 100755 test/preprocess3/compound-binding-element/locales/compound-binding-element.fr.json create mode 100644 test/preprocess3/edge-case-dom-bind.json create mode 100644 test/preprocess3/edge-case-test-imports.js create mode 100644 test/preprocess3/edge-case-test-suites.js create mode 100644 test/preprocess3/edge-case-test.html create mode 100644 test/preprocess3/edge-case/advanced-binding-element.js create mode 100644 test/preprocess3/edge-case/advanced-binding-element.json create mode 100644 test/preprocess3/edge-case/complex-compound-binding-element.js create mode 100644 test/preprocess3/edge-case/complex-compound-binding-element.json create mode 100644 test/preprocess3/edge-case/empty-element.js create mode 100644 test/preprocess3/edge-case/empty-element.json create mode 100755 test/preprocess3/edge-case/locales/advanced-binding-element.fr.json create mode 100755 test/preprocess3/edge-case/locales/complex-compound-binding-element.fr.json create mode 100755 test/preprocess3/edge-case/locales/empty-element.fr.json create mode 100644 test/preprocess3/edge-case/no-template-element.js create mode 100644 test/preprocess3/fake-server.js create mode 100644 test/preprocess3/fallback-text-element/fallback-text-element.js create mode 100644 test/preprocess3/fallback-text-element/fallback-text-element.json create mode 100755 test/preprocess3/fallback-text-element/locales/fallback-text-element.fr-CA.json create mode 100755 test/preprocess3/fallback-text-element/locales/fallback-text-element.fr.json create mode 100755 test/preprocess3/locales/compound-binding-dom-bind.fr.json create mode 100755 test/preprocess3/locales/simple-attribute-dom-bind.fr.json create mode 100755 test/preprocess3/locales/simple-text-dom-bind.fr.json create mode 100644 test/preprocess3/multiple-case-test-imports.js create mode 100644 test/preprocess3/multiple-case-test-suites.js create mode 100644 test/preprocess3/multiple-case-test.html create mode 100644 test/preprocess3/multiple-case/item-element.js create mode 100644 test/preprocess3/multiple-case/item-element.json create mode 100755 test/preprocess3/multiple-case/locales/item-element.fr.json create mode 100644 test/preprocess3/multiple-case/locales/multiple-element.fr.json create mode 100644 test/preprocess3/multiple-case/multiple-element.js create mode 100644 test/preprocess3/multiple-case/multiple-element.json create mode 100644 test/preprocess3/no-persist-test-imports.js create mode 100644 test/preprocess3/no-persist-test-suites.js create mode 100644 test/preprocess3/no-persist-test.html create mode 100755 test/preprocess3/plural-gender-element/locales/plural-gender-element.fr.json create mode 100644 test/preprocess3/plural-gender-element/plural-gender-element.js create mode 100644 test/preprocess3/plural-gender-element/plural-gender-element.json create mode 100644 test/preprocess3/preference-test-imports.js create mode 100644 test/preprocess3/preference-test-suites.js create mode 100644 test/preprocess3/preference-test.html create mode 100644 test/preprocess3/preference/preference-element.js create mode 100644 test/preprocess3/preference/preference-element.json create mode 100644 test/preprocess3/simple-attribute-dom-bind.json create mode 100755 test/preprocess3/simple-attribute-element/locales/simple-attribute-element.fr.json create mode 100644 test/preprocess3/simple-attribute-element/locales/text-attribute-element.fr.json create mode 100644 test/preprocess3/simple-attribute-element/simple-attribute-element.js create mode 100644 test/preprocess3/simple-attribute-element/simple-attribute-element.json create mode 100644 test/preprocess3/simple-attribute-element/text-attribute-element.js create mode 100644 test/preprocess3/simple-attribute-element/text-attribute-element.json create mode 100644 test/preprocess3/simple-text-dom-bind.json create mode 100755 test/preprocess3/simple-text-element/locales/simple-text-element.fr.json create mode 100644 test/preprocess3/simple-text-element/locales/simple-text-element.ru.json create mode 100644 test/preprocess3/simple-text-element/simple-text-element.js create mode 100644 test/preprocess3/simple-text-element/simple-text-element.json create mode 100755 test/preprocess3/simple-text-id-element/locales/simple-text-id-element.fr.json create mode 100644 test/preprocess3/simple-text-id-element/simple-text-id-element.js create mode 100644 test/preprocess3/simple-text-id-element/simple-text-id-element.json create mode 100644 test/preprocess3/template-default-lang-test-imports.js create mode 100644 test/preprocess3/template-default-lang-test-suites.js create mode 100644 test/preprocess3/template-default-lang-test.html create mode 100755 test/preprocess3/template-default-lang/locales/null-template-default-lang-element.zh-Hans-CN.json create mode 100755 test/preprocess3/template-default-lang/locales/template-default-lang-element.zh-Hans-CN.json create mode 100644 test/preprocess3/template-default-lang/null-template-default-lang-element.js create mode 100644 test/preprocess3/template-default-lang/null-template-default-lang-element.json create mode 100644 test/preprocess3/template-default-lang/template-default-lang-element.js create mode 100644 test/preprocess3/template-default-lang/template-default-lang-element.json create mode 100755 test/preprocess3/test-runner.js create mode 100755 test/src3/basic-test-dom-bind-dummy.html create mode 100644 test/tmp/basic-test-dom-bind-dummy.html create mode 100644 test/tmp/basic-test.html create mode 100644 test/tmp/commented-simple-text-element/commented-simple-text-element.html create mode 100644 test/tmp/commented-simple-text-element/commented-simple-text-element.json create mode 100644 test/tmp/compound-binding-dom-bind.json create mode 100644 test/tmp/compound-binding-element/compound-binding-element.html create mode 100644 test/tmp/compound-binding-element/compound-binding-element.json create mode 100644 test/tmp/edge-case-dom-bind.json create mode 100644 test/tmp/edge-case-test.html create mode 100644 test/tmp/edge-case/advanced-binding-element.html create mode 100644 test/tmp/edge-case/advanced-binding-element.json create mode 100644 test/tmp/edge-case/complex-compound-binding-element.html create mode 100644 test/tmp/edge-case/complex-compound-binding-element.json create mode 100644 test/tmp/edge-case/empty-element.html create mode 100644 test/tmp/edge-case/empty-element.json create mode 100644 test/tmp/fallback-text-element/fallback-text-element.html create mode 100644 test/tmp/fallback-text-element/fallback-text-element.json create mode 100644 test/tmp/i18n-attr-repo.html create mode 100644 test/tmp/i18n-attr-repo.js create mode 100644 test/tmp/multiple-case-test.html create mode 100644 test/tmp/multiple-case/item-element.html create mode 100644 test/tmp/multiple-case/item-element.json create mode 100644 test/tmp/multiple-case/multiple-element.html create mode 100644 test/tmp/multiple-case/multiple-element.json create mode 100644 test/tmp/no-persist-test.html create mode 100644 test/tmp/plural-gender-element/plural-gender-element.html create mode 100644 test/tmp/plural-gender-element/plural-gender-element.json create mode 100644 test/tmp/preference-test.html create mode 100644 test/tmp/preference/preference-element.html create mode 100644 test/tmp/preference/preference-element.json create mode 100644 test/tmp/simple-attribute-dom-bind.json create mode 100644 test/tmp/simple-attribute-element/simple-attribute-element.html create mode 100644 test/tmp/simple-attribute-element/simple-attribute-element.json create mode 100644 test/tmp/simple-attribute-element/text-attribute-element.html create mode 100644 test/tmp/simple-attribute-element/text-attribute-element.json create mode 100644 test/tmp/simple-text-dom-bind.json create mode 100644 test/tmp/simple-text-element/simple-text-element.html create mode 100644 test/tmp/simple-text-element/simple-text-element.json create mode 100644 test/tmp/simple-text-id-element/simple-text-id-element.html create mode 100644 test/tmp/simple-text-id-element/simple-text-id-element.json create mode 100644 test/tmp/template-default-lang-test.html create mode 100644 test/tmp/template-default-lang/null-template-default-lang-element.html create mode 100644 test/tmp/template-default-lang/null-template-default-lang-element.json create mode 100644 test/tmp/template-default-lang/template-default-lang-element.html create mode 100644 test/tmp/template-default-lang/template-default-lang-element.json diff --git a/package.json b/package.json index 6ced0d66..58422b83 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "homepage": "https://github.com/t2ym/i18n-element#readme", "name": "i18n-element", - "version": "3.0.0-pre.6", + "version": "3.0.0-pre.7", "main": "i18n-element.js", "directories": { "test": "test" diff --git a/test/index.html b/test/index.html index bea7878f..d669e427 100755 --- a/test/index.html +++ b/test/index.html @@ -27,7 +27,7 @@ //'src2', 'src3', //'preprocess2', - //'preprocess3', + 'preprocess3', //'bundled', //'minify2-min' ] : @@ -35,7 +35,7 @@ //'src2', 'src3', //'preprocess2', - //'preprocess3', + 'preprocess3', //'bundled', //'minify2-min' ] diff --git a/test/preprocess3/basic-test-dom-bind-dummy.html b/test/preprocess3/basic-test-dom-bind-dummy.html new file mode 100644 index 00000000..24d5f18d --- /dev/null +++ b/test/preprocess3/basic-test-dom-bind-dummy.html @@ -0,0 +1,570 @@ + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ + + + \ No newline at end of file diff --git a/test/preprocess3/basic-test-imports.js b/test/preprocess3/basic-test-imports.js new file mode 100644 index 00000000..09e916c3 --- /dev/null +++ b/test/preprocess3/basic-test-imports.js @@ -0,0 +1,29 @@ +import './fake-server.js'; +import './test-runner.js'; +import '../../i18n-element.js'; +import '../../define-element.js'; +import '../../i18n-dom-bind.js'; +import './simple-text-element/simple-text-element.js'; +import './commented-simple-text-element/commented-simple-text-element.js'; +import './plural-gender-element/plural-gender-element.js'; +import './simple-attribute-element/simple-attribute-element.js'; +import './fallback-text-element/fallback-text-element.js'; +import './compound-binding-element/compound-binding-element.js'; +import './simple-text-id-element/simple-text-id-element.js'; +import './basic-test-suites.js'; + +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +/* + + + +*/ +/* + FIXME(polymer-modulizer): the above comments were extracted + from HTML and may be out of place here. Review them and + then delete this comment! +*/ +; diff --git a/test/preprocess3/basic-test-suites.js b/test/preprocess3/basic-test-suites.js new file mode 100644 index 00000000..2140e2ad --- /dev/null +++ b/test/preprocess3/basic-test-suites.js @@ -0,0 +1,1299 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import './test-runner.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +let intervalId = setInterval(function () { +var bind = document.querySelector('#simple-attribute-dom-bind'); +if (bind) { + clearInterval(intervalId); +} +else { + return; +} + +bind.addEventListener('dom-change', function onDomChangeForBind (event) { + if (!bind.done && event.target === bind) { + bind._langUpdated = function (e) { + if (e.composedPath()[0] === this) { + console.log('bind._langUpdated: ' + this.is + ' ' + this.id + ' ' + e.type + ' ' + this.lang + ' params.lang = ' + (this.params ? this.params.lang : '')); + console.log('bind._langUpdated: deepcopying model for lang ' + this.lang); + this.model = deepcopy(this.text.model); + this.notifyPath('model', this.model); + this.render(); + } + }.bind(bind); + + bind._onDomChangeAfterLangUpdated = function (e) { + console.log('bind._onDomChangeAfterLangUpdated ' + this.is + ' ' + this.id + ' ' + e.type + ' ' + this.lang + ' params.lang = ' + (this.params ? this.params.lang : '')); + if (this.params && this.params.lang === this.lang) { + console.log('bind._onDomChangeAfterLangUpdated ' + this.is + ' ' + this.id + ' ' + e.type + ' firing local-dom-ready'); + this.fire('local-dom-ready'); + } + e.stopPropagation(); + return false; + }.bind(bind); + + bind.addEventListener('lang-updated', bind._langUpdated); + bind.addEventListener('dom-change', bind._onDomChangeAfterLangUpdated); + + window.removeEventListener('dom-change', onDomChangeForBind); + bind.done = true; + } +}); +}, 10); + +suite('I18nElement with ' + + (window.location.href.indexOf('?dom=Shadow') >= 0 ? 'Shadow DOM' : 'Shady DOM') + + (' in ' + syntax + ' syntax'), + function () { + + var lang0 = ''; + var lang1 = 'en'; + var lang2 = 'fr'; + var lang3 = 'ja'; + var lang4 = 'fr-CA'; + var lang5 = 'zh-Hans-CN'; + var lang6 = 'ru'; + var text_simple = { + 'model': {}, + 'text': ' outermost text at the beginning ', + 'h1_3': 'outermost header 1', + 'text_4': ' outermost text in the middle ', + 'span_5': 'simple text without id', + 'span_6': 'simple text without id 2', + 'label-1': 'simple text with id', + 'label-2': 'simple text with id 2', + 'div_9:span': 'simple text within div', + 'div_9:span_1': 'simple text within div 2', + 'div_9:div_2:div': 'great grandchild text within div', + 'div_10:text': ' simple text as the first element in div ', + 'div_10:span_1': 'simple text within div', + 'div_10:text_2': ' simple text in the middle of div ', + 'div_10:span_3': 'simple text within div 2', + 'div_10:div_4:div': 'great grandchild text within div', + 'div_10:text_5': ' simple text at the last element in div ', + 'toplevel-div:span': 'simple text within div', + 'toplevel-div:span_1': 'simple text within div 2', + 'third-level-div': 'great grandchild text within div', + 'second-level-div:div_1': 'great grandchild text within div without id', + 'div_12:ul:li': 'line item without id 1', + 'div_12:ul:li_1': 'line item without id 2', + 'div_12:ul:li_2': 'line item without id 3', + 'line-items:li': 'line item with id 1', + 'line-items:li_1': 'line item with id 2', + 'line-items:li_2': 'line item with id 3', + 'p_13': [ + 'A paragraph with {1} is converted to {2}.', + 'parameters', + '' + ], + 'paragraph': [ + 'A paragraph with {1} is converted to {2}.', + 'id', + '' + ], + 'text_15': ' outermost text at the end ' + }; + var localDOM_simple = [ + { select: 'div:not([id])', 'previousTextSibling.data': ' outermost text at the beginning ' }, + { select: 'h1', textContent: 'outermost header 1' }, + { select: 'h1', 'nextTextSibling.data': ' outermost text in the middle ' }, + { select: 'span:not([id])', textContent: [ 'simple text without id', 'simple text without id 2' ] }, + { select: 'span[id="label-1"]', textContent: 'simple text with id' }, + { select: 'span[id="label-2"]', textContent: 'simple text with id 2' }, + { select: 'span[id="label-2"] + div span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[id="label-2"] + div div:not([id]) div:not([id])', textContent: [ 'great grandchild text within div' ] }, + { select: 'span[id="label-2"] + div + div', 'childNodes.0.data': ' simple text as the first element in div ' }, + { select: 'span[id="label-2"] + div + div span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[id="label-2"] + div + div span:not([id])', 'nextTextSibling.data': ' simple text in the middle of div ' }, + { select: 'span[id="label-2"] + div + div div:not([id]) div:not([id])', textContent: 'great grandchild text within div' }, + { select: 'span[id="label-2"] + div + div div:not([id])', 'nextTextSibling.data': ' simple text at the last element in div ' }, + { select: '[id="toplevel-div"] span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: '[id="third-level-div"]', textContent: 'great grandchild text within div' }, + { select: '[id="second-level-div"] div:not([id])', textContent: 'great grandchild text within div without id' }, + { select: 'div ul:not([id]) li:not([id])', textContent: [ 'line item without id 1', 'line item without id 2', 'line item without id 3' ] }, + { select: '[id="line-items"] li:not([id])', textContent: [ 'line item with id 1', 'line item with id 2', 'line item with id 3' ] }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.0.textContent': 'A paragraph with {1} is converted to {2}.' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'parameters', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': '', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.0.textContent': 'A paragraph with {1} is converted to {2}.' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'id', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': '', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"]', 'nextTextSibling.data': ' outermost text at the end ' } + ]; + var text_simple_text_id = { + 'model': {}, + 'text': ' outermost text at the beginning ', + 'h1_3': 'outermost header 1', + 'text_4': ' outermost text in the middle ', + 'span_5': 'simple text without id', + 'span_6': 'simple text without id 2', + 'label-1': 'simple text with id', + 'label-2': 'simple text with id 2', + 'div_9:span': 'simple text within div', + 'div_9:span_1': 'simple text within div 2', + 'div_9:div_2:div': 'great grandchild text within div', + 'div_10:text': ' simple text as the first element in div ', + 'div_10:span_1': 'simple text within div', + 'div_10:text_2': ' simple text in the middle of div ', + 'div_10:span_3': 'simple text within div 2', + 'div_10:div_4:div': 'great grandchild text within div', + 'div_10:text_5': ' simple text at the last element in div ', + 'toplevel-div:span': 'simple text within div', + 'toplevel-div:span_1': 'simple text within div 2', + 'second-level-div': [ + ' {1}\n {2} ', + 'great grandchild text within div', + 'great grandchild text within div without id' + ], + 'div_12:ul:li': 'line item without id 1', + 'div_12:ul:li_1': 'line item without id 2', + 'div_12:ul:li_2': 'line item without id 3', + 'line-items': [ + ' {1}\n {2}\n {3} ', + 'line item with id 1', + 'line item with id 2', + 'line item with id 3' + ], + 'p_13': [ + 'A paragraph with {1} is converted to {2}.', + 'parameters', + '' + ], + 'paragraph': [ + 'A paragraph with {1} is converted to {2}.', + 'id', + '' + ], + 'text_15': ' outermost text at the end ' + }; + var localDOM_simple_text_id = [ + { select: 'div:not([text-id])', 'previousTextSibling.data': ' outermost text at the beginning ' }, + { select: 'h1', textContent: 'outermost header 1' }, + { select: 'h1', 'nextTextSibling.data': ' outermost text in the middle ' }, + { select: 'span:not([text-id])', textContent: [ 'simple text without id', 'simple text without id 2' ] }, + { select: 'span[text-id="label-1"]', textContent: 'simple text with id' }, + { select: 'span[text-id="label-2"]', textContent: 'simple text with id 2' }, + { select: 'span[text-id="label-2"] + div span:not([text-id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[text-id="label-2"] + div div:not([text-id]) div:not([text-id])', textContent: [ 'great grandchild text within div' ] }, + { select: 'span[text-id="label-2"] + div + div', 'childNodes.0.data': ' simple text as the first element in div ' }, + { select: 'span[text-id="label-2"] + div + div span:not([text-id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[text-id="label-2"] + div + div span:not([text-id])', 'nextTextSibling.data': ' simple text in the middle of div ' }, + { select: 'span[text-id="label-2"] + div + div div:not([text-id]) div:not([text-id])', textContent: 'great grandchild text within div' }, + { select: 'span[text-id="label-2"] + div + div div:not([text-id])', 'nextTextSibling.data': ' simple text at the last element in div ' }, + { select: '[text-id="toplevel-div"] span:not([text-id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: '[text-id="second-level-div"] i18n-format', + 'PolymerDom.children.0.textContent': ' {1}\n {2} ' }, + { select: '[text-id="second-level-div"] i18n-format', + 'PolymerDom.children.1.tagName': 'DIV', + 'PolymerDom.children.1.textContent': 'great grandchild text within div', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: '[text-id="second-level-div"] i18n-format', + 'PolymerDom.children.2.tagName': 'DIV', + 'PolymerDom.children.2.textContent': 'great grandchild text within div without id', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: 'div ul:not([text-id]) li:not([text-id])', textContent: [ 'line item without id 1', 'line item without id 2', 'line item without id 3' ] }, + { select: '[text-id="line-items"] i18n-format', + 'PolymerDom.children.0.textContent': ' {1}\n {2}\n {3} ' }, + { select: '[text-id="line-items"] i18n-format', + 'PolymerDom.children.1.tagName': 'LI', + 'PolymerDom.children.1.textContent': 'line item with id 1', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: '[text-id="line-items"] i18n-format', + 'PolymerDom.children.2.tagName': 'LI', + 'PolymerDom.children.2.textContent': 'line item with id 2', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[text-id="line-items"] i18n-format', + 'PolymerDom.children.3.tagName': 'LI', + 'PolymerDom.children.3.textContent': 'line item with id 3', + 'PolymerDom.children.3.attributes.slot.value': '3' }, + { select: 'p:not([text-id]) i18n-format', + 'PolymerDom.children.0.textContent': 'A paragraph with {1} is converted to {2}.' }, + { select: 'p:not([text-id]) i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'parameters', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: 'p:not([text-id]) i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': '', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[text-id="paragraph"] i18n-format', + 'PolymerDom.children.0.textContent': 'A paragraph with {1} is converted to {2}.' }, + { select: '[text-id="paragraph"] i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'id', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: '[text-id="paragraph"] i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': '', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[text-id="paragraph"]', 'nextTextSibling.data': ' outermost text at the end ' } + ]; + var sender1 = { + 'name': 'Joe', + 'gender': 'male' + }; + var recipients1 = [ + { 'name': 'Alice', 'gender': 'female' }, + { 'name': 'Bob', 'gender': 'male' }, + { 'name': 'Yoda', 'gender': 'other' } + ]; + var recipients2 = [ + { 'name': 'Alice', 'gender': 'female' }, + { 'name': 'Bob', 'gender': 'male' } + ]; + var recipients3 = [ + { 'name': 'Bob', 'gender': 'male' } + ]; + var recipients4 = []; + var text_plural_gender = { + 'model': {}, + 'compound-format-text': [ + { + '0': 'You ({3}) gave no gifts.', + '1': { + 'male': 'You ({3}) gave him ({4}) {5}.', + 'female': 'You ({3}) gave her ({4}) {5}.', + 'other': 'You ({3}) gave them ({4}) {5}.' + }, + 'one': { + 'male': 'You ({3}) gave him ({4}) and one other person {5}.', + 'female': 'You ({3}) gave her ({4}) and one other person {5}.', + 'other': 'You ({3}) gave them ({4}) and one other person {5}.' + }, + 'other': 'You ({3}) gave them ({4}) and {1} other people gifts.' + }, + '{{recipients.length - 1}}', + '{{recipients.0.gender}}', + '{{sender.name}}', + '{{recipients.0.name}}', + 'a gift' + ] + }; + var localDOM_plural_gender_1 = [ + { select: '#compound-format-text', 'root.PolymerDom.textContent': 'You () gave them () and other people gifts.' }, + { select: '#compound-format-text', 'PolymerDom.children.1.PolymerDom.childNodes.0.data.raw': '3' }, + { select: '#compound-format-text', 'PolymerDom.children.2.PolymerDom.childNodes.0.data.raw': 'female' }, + { select: '#compound-format-text', 'PolymerDom.children.3.PolymerDom.childNodes.0.data.raw': 'Joe' }, + { select: '#compound-format-text', 'PolymerDom.children.4.PolymerDom.childNodes.0.data.raw': 'Alice' }, + { select: '#compound-format-text', 'PolymerDom.children.5.PolymerDom.childNodes.0.data': 'a gift' } + ]; + var localDOM_plural_gender_2 = [ + { select: '#compound-format-text', 'root.PolymerDom.textContent': 'You () gave her () and one other person .' }, + { select: '#compound-format-text', 'PolymerDom.children.1.PolymerDom.childNodes.0.data.raw': '2' }, + { select: '#compound-format-text', 'PolymerDom.children.2.PolymerDom.childNodes.0.data.raw': 'female' }, + { select: '#compound-format-text', 'PolymerDom.children.3.PolymerDom.childNodes.0.data.raw': 'Joe' }, + { select: '#compound-format-text', 'PolymerDom.children.4.PolymerDom.childNodes.0.data.raw': 'Alice' }, + { select: '#compound-format-text', 'PolymerDom.children.5.PolymerDom.childNodes.0.data': 'a gift' } + ]; + var localDOM_plural_gender_3 = [ + { select: '#compound-format-text', 'root.PolymerDom.textContent': 'You () gave him () .' }, + { select: '#compound-format-text', 'PolymerDom.children.1.PolymerDom.childNodes.0.data.raw': '1' }, + { select: '#compound-format-text', 'PolymerDom.children.2.PolymerDom.childNodes.0.data.raw': 'male' }, + { select: '#compound-format-text', 'PolymerDom.children.3.PolymerDom.childNodes.0.data.raw': 'Joe' }, + { select: '#compound-format-text', 'PolymerDom.children.4.PolymerDom.childNodes.0.data.raw': 'Bob' }, + { select: '#compound-format-text', 'PolymerDom.children.5.PolymerDom.childNodes.0.data': 'a gift' } + ]; + var localDOM_plural_gender_4 = [ + { select: '#compound-format-text', 'root.PolymerDom.textContent': 'You () gave no gifts.' }, + { select: '#compound-format-text', 'PolymerDom.children.1.PolymerDom.childNodes.0.data.raw': '0' }, + { select: '#compound-format-text', 'PolymerDom.children.2.PolymerDom.childNodes.0.data.raw': '' }, + { select: '#compound-format-text', 'PolymerDom.children.3.PolymerDom.childNodes.0.data.raw': 'Joe' }, + { select: '#compound-format-text', 'PolymerDom.children.4.PolymerDom.childNodes.0.data.raw': '' }, + { select: '#compound-format-text', 'PolymerDom.children.5.PolymerDom.childNodes.0.data': 'a gift' } + ]; + var text_simple_attribute = { + 'model': { + 'standard-input': { + 'placeholder': 'standard HTML5 attribute' + }, + 'outer-div:input_2': { + 'placeholder': 'standard HTML5 attribute without id' + }, + 'paper-input-element': { + 'label': 'paper-input label', + 'error-message': 'paper-input error message', + 'placeholder': 'paper-input placeholder' + }, + 'outer-div:paper-input_4': { + 'label': 'paper-input label without id', + 'error-message': 'paper-input error message without id', + 'placeholder': 'paper-input placeholder without id' + }, + 'pie-chart': { + 'options': { + 'title': 'Distribution of days in 2001H1' + }, + 'cols': [ + { + 'label': 'Month', + 'type': 'string' + }, + { + 'label': 'Days', + 'type': 'number' + } + ], + 'rows': [ + [ + 'Jan', + 31 + ], + [ + 'Feb', + 28 + ], + [ + 'Mar', + 31 + ], + [ + 'Apr', + 30 + ], + [ + 'May', + 31 + ], + [ + 'Jun', + 30 + ] + ] + }, + 'column-chart': { + 'options': { + 'title': 'Inventory' + }, + 'data': [ + [ + 'Year', + 'Things', + 'Stuff' + ], + [ + '2004', + 1000, + 400 + ], + [ + '2005', + 1170, + 460 + ], + [ + '2006', + 660, + 1120 + ], + [ + '2007', + 1030, + 540 + ] + ] + }, + 'custom-attr': { + 'custom-text-attr1': 'custom text attribute 1', + 'custom-text-attr2': 'custom text attribute 2', + 'custom-text-attr3': 'custom text attribute 3' + }, + 'selective-attr': { + 'custom-text-attr4': [ + '{1} custom-text-attr4 attribute with param {2} and param {3} {4}', + '{{text.ordinary-div}}', + '{{text.ordinary-div}}', + '[[text.ordinary-div]]', + '{{text.ordinary-div}}' + ], + 'custom-text-attr5': [ + '[[text.ordinary-div]]', + ' custom-text-attr5 attribute with param ', + "{{or('',text.ordinary-div)}}", + ' and param ', + '[[text.ordinary-div]]' + ], + 'i18n-target': [ + 'i18n-target attribute with param {1} and param {2}', + '{{text.ordinary-div}}', + '[[text.ordinary-div]]' + ], + 'i18n-target2': [ + 'i18n-target2 attribute with param ', + "{{or('',text.ordinary-div)}}", + ' and param ', + '[[text.ordinary-div]]' + ] + }, + 'selective-attr2': { + 'i18n-target': 'i18n-target attribute 2' + }, + 'selective-attr3': { + 'i18n-target6': 'i18n-target6 attribute 2' + }, + 'selective-attr4': { + 'i18n-target6': 'i18n-target6 attribute 3' + }, + 'json-data-id': { + 'attr1': 'this attr1 is extracted', + 'i18n-target-attr': 'this attribute is also extracted' + }, + 'template_2:json-data_1': { + 'attr1': 'this attr1 without id is extracted', + 'i18n-target-attr': 'this attribute without id is also extracted' + } + }, + 'ordinary-div': 'text 1' + }; + var model_simple_attribute = { + 'standard-input': { + 'placeholder': 'standard HTML5 attribute' + }, + 'outer-div:input_2': { + 'placeholder': 'standard HTML5 attribute without id' + }, + 'paper-input-element': { + 'label': 'paper-input label', + 'error-message': 'paper-input error message', + 'placeholder': 'paper-input placeholder' + }, + 'outer-div:paper-input_4': { + 'label': 'paper-input label without id', + 'error-message': 'paper-input error message without id', + 'placeholder': 'paper-input placeholder without id' + }, + 'pie-chart': { + 'options': { + 'title': 'Distribution of days in 2001H1' + }, + 'cols': [ + { + 'label': 'Month', + 'type': 'string' + }, + { + 'label': 'Days', + 'type': 'number' + } + ], + 'rows': [ + [ + 'Jan', + 31 + ], + [ + 'Feb', + 28 + ], + [ + 'Mar', + 31 + ], + [ + 'Apr', + 30 + ], + [ + 'May', + 31 + ], + [ + 'Jun', + 30 + ] + ] + }, + 'column-chart': { + 'options': { + 'title': 'Inventory' + }, + 'data': [ + [ + 'Year', + 'Things', + 'Stuff' + ], + [ + '2004', + 1000, + 400 + ], + [ + '2005', + 1170, + 460 + ], + [ + '2006', + 660, + 1120 + ], + [ + '2007', + 1030, + 540 + ] + ] + }, + 'custom-attr': { + 'custom-text-attr1': 'custom text attribute 1', + 'custom-text-attr2': 'custom text attribute 2', + 'custom-text-attr3': 'custom text attribute 3' + }, + 'selective-attr': { + 'custom-text-attr4': [ + '{1} custom-text-attr4 attribute with param {2} and param {3} {4}', + '{{text.ordinary-div}}', + '{{text.ordinary-div}}', + '[[text.ordinary-div]]', + '{{text.ordinary-div}}' + ], + 'custom-text-attr5': [ + '[[text.ordinary-div]]', + ' custom-text-attr5 attribute with param ', + "{{or('',text.ordinary-div)}}", + ' and param ', + '[[text.ordinary-div]]' + ], + 'i18n-target': [ + 'i18n-target attribute with param {1} and param {2}', + '{{text.ordinary-div}}', + '[[text.ordinary-div]]' + ], + 'i18n-target2': [ + 'i18n-target2 attribute with param ', + "{{or('',text.ordinary-div)}}", + ' and param ', + '[[text.ordinary-div]]' + ] + }, + 'selective-attr2': { + 'i18n-target': 'i18n-target attribute 2' + }, + 'selective-attr3': { + 'i18n-target6': 'i18n-target6 attribute 2' + }, + 'selective-attr4': { + 'i18n-target6': 'i18n-target6 attribute 3' + }, + 'json-data-id': { + 'attr1': 'this attr1 is extracted', + 'i18n-target-attr': 'this attribute is also extracted' + }, + 'template_2:json-data_1': { + 'attr1': 'this attr1 without id is extracted', + 'i18n-target-attr': 'this attribute without id is also extracted' + } + }; + var localDOM_simple_attribute = [ + { select: 'input[id="standard-input"]', 'placeholder.text': 'standard HTML5 attribute' }, + { select: 'input[id="standard-input"] + input', 'placeholder.text': 'standard HTML5 attribute without id' }, + { select: 'paper-input[id="paper-input-element"]', 'label.text': 'paper-input label', 'errorMessage.text': 'paper-input error message', 'placeholder.text': 'paper-input placeholder' }, + { select: 'paper-input[id="paper-input-element"] + paper-input', 'label.text': 'paper-input label without id', 'errorMessage.text': 'paper-input error message without id', 'placeholder.text': 'paper-input placeholder without id' }, + { select: 'google-chart[id="pie-chart"]', 'options.title.text': 'Distribution of days in 2001H1', 'cols.0.label.text': 'Month', 'cols.1.label.text': 'Days', 'rows.0.0.text': 'Jan', 'rows.1.0.text': 'Feb', 'rows.2.0.text': 'Mar', 'rows.3.0.text': 'Apr', 'rows.4.0.text': 'May', 'rows.5.0.text': 'Jun' }, + { select: 'google-chart[id="column-chart"]', 'options.title.text': 'Inventory', 'data.0.0.text': 'Year', 'data.0.1.text': 'Things', 'data.0.2.text': 'Stuff' }, + { select: 'text-attribute-element[id="custom-attr"]', 'customTextAttr1.text': 'custom text attribute 1', 'customTextAttr2.text': 'custom text attribute 2', 'customTextAttr3.text': 'custom text attribute 3' }, + { select: 'text-attribute-element[id="selective-attr"]', 'i18nTarget.raw': 'i18n-target attribute with param text 1 and param text 1', 'i18nTarget2.raw': 'i18n-target2 attribute with param text 1 and param text 1' }, + { select: 'span[id="test-json-data-1"]', 'textContent': 'this attr1 is extracted' }, + { select: 'span[id="test-json-data-2"]', 'textContent': 'this attribute is also extracted' }, + { select: 'span[id="test-json-data-3"]', 'textContent': 'this attr1 without id is extracted' }, + { select: 'span[id="test-json-data-4"]', 'textContent': 'this attribute without id is also extracted' }, + ]; + var localDOM_simple_attribute_fr = [ + { select: 'input[id="standard-input"]', 'placeholder.text': 'standard HTML5 attribute' }, + { select: 'input[id="standard-input"] + input', 'placeholder.text': 'standard HTML5 attribute without id' }, + { select: 'paper-input[id="paper-input-element"]', 'label.text': 'paper-input label', 'errorMessage.text': 'paper-input error message', 'placeholder.text': 'paper-input placeholder' }, + { select: 'paper-input[id="paper-input-element"] + paper-input', 'label.text': 'paper-input label without id', 'errorMessage.text': 'paper-input error message without id', 'placeholder.text': 'paper-input placeholder without id' }, + { select: 'google-chart[id="pie-chart"]', 'options.title.text': 'Distribution of days in 2001H1', 'cols.0.label.text': 'Month', 'cols.1.label.text': 'Days', 'rows.0.0.text': 'Jan', 'rows.1.0.text': 'Feb', 'rows.2.0.text': 'Mar', 'rows.3.0.text': 'Apr', 'rows.4.0.text': 'May', 'rows.5.0.text': 'Jun' }, + { select: 'google-chart[id="column-chart"]', 'options.title.text': 'Inventory', 'data.0.0.text': 'Year', 'data.0.1.text': 'Things', 'data.0.2.text': 'Stuff' }, + { select: 'text-attribute-element[id="custom-attr"]', 'customTextAttr1.text': 'custom text attribute 1', 'customTextAttr2.text': 'custom text attribute 2', 'customTextAttr3.text': 'custom text attribute 3' }, + { select: 'text-attribute-element[id="selective-attr"]', 'i18nTarget.raw': 'fr i18n-target attribute with param fr text 1 and param fr text 1', 'i18nTarget2.raw': 'fr i18n-target2 attribute with param fr text 1 fr and param fr text 1' }, + { select: 'span[id="test-json-data-1"]', 'textContent': 'this attr1 is extracted' }, + { select: 'span[id="test-json-data-2"]', 'textContent': 'this attribute is also extracted' }, + { select: 'span[id="test-json-data-3"]', 'textContent': 'this attr1 without id is extracted' }, + { select: 'span[id="test-json-data-4"]', 'textContent': 'this attribute without id is also extracted' }, + ]; + var text_fallback = { + 'model': {}, + 'text': 'fr-CA outermost text at the beginning ', + 'h1_3': 'fr-CA outermost header 1', + 'text_4': 'fr-CA outermost text in the middle ', + 'span_5': 'fr-CA simple text without id', + 'span_6': 'fr-CA simple text without id 2', + 'label-1': 'fr-CA simple text with id', + 'label-2': 'fr-CA simple text with id 2', + 'div_9:span': 'simple text within div', + 'div_9:span_1': 'simple text within div 2', + 'div_9:div_2:div': 'great grandchild text within div', + 'div_10:text': ' simple text as the first element in div ', + 'div_10:span_1': 'fr-CA simple text within div', + 'div_10:text_2': ' simple text in the middle of div ', + 'div_10:span_3': 'simple text within div 2', + 'div_10:div_4:div': 'great grandchild text within div', + 'div_10:text_5': ' simple text at the last element in div ', + 'toplevel-div:span': 'fr-CA simple text within div', + 'toplevel-div:span_1': 'fr-CA simple text within div 2', + 'third-level-div': 'fr-CA great grandchild text within div', + 'second-level-div:div_1': 'fr-CA great grandchild text within div without id', + 'div_12:ul:li': 'fr line item without id 1', + 'div_12:ul:li_1': 'fr line item without id 2', + 'div_12:ul:li_2': 'fr line item without id 3', + 'line-items:li': 'fr line item with id 1', + 'line-items:li_1': 'fr line item with id 2', + 'line-items:li_2': 'fr line item with id 3', + 'p_13': [ + 'fr-CA A paragraph with {1} is converted to {2}.', + 'fr-CA parameters', + 'fr-CA ' + ], + 'paragraph': [ + 'fr-CA A paragraph with {1} is converted to {2}.', + 'fr-CA id', + 'fr-CA ' + ], + 'text_15': 'fr-CA outermost text at the end ' + }; + var localDOM_fallback = [ + { select: 'div:not([id])', 'previousTextSibling.data': 'fr-CA outermost text at the beginning ' }, + { select: 'h1', textContent: 'fr-CA outermost header 1' }, + { select: 'h1', 'nextTextSibling.data': 'fr-CA outermost text in the middle ' }, + { select: 'span:not([id])', textContent: [ 'fr-CA simple text without id', 'fr-CA simple text without id 2' ] }, + { select: 'span[id="label-1"]', textContent: 'fr-CA simple text with id' }, + { select: 'span[id="label-2"]', textContent: 'fr-CA simple text with id 2' }, + { select: 'span[id="label-2"] + div span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[id="label-2"] + div div:not([id]) div:not([id])', textContent: [ 'great grandchild text within div' ] }, + { select: 'span[id="label-2"] + div + div', 'childNodes.0.data': ' simple text as the first element in div ' }, + { select: 'span[id="label-2"] + div + div span:not([id])', textContent: [ 'fr-CA simple text within div', 'simple text within div 2' ] }, + { select: 'span[id="label-2"] + div + div span:not([id])', 'nextTextSibling.data': ' simple text in the middle of div ' }, + { select: 'span[id="label-2"] + div + div div:not([id]) div:not([id])', textContent: 'great grandchild text within div' }, + { select: 'span[id="label-2"] + div + div div:not([id])', 'nextTextSibling.data': ' simple text at the last element in div ' }, + { select: '[id="toplevel-div"] span:not([id])', textContent: [ 'fr-CA simple text within div', 'fr-CA simple text within div 2' ] }, + { select: '[id="third-level-div"]', textContent: 'fr-CA great grandchild text within div' }, + { select: '[id="second-level-div"] div:not([id])', textContent: 'fr-CA great grandchild text within div without id' }, + { select: 'div ul:not([id]) li:not([id])', textContent: [ 'fr line item without id 1', 'fr line item without id 2', 'fr line item without id 3' ] }, + { select: '[id="line-items"] li:not([id])', textContent: [ 'fr line item with id 1', 'fr line item with id 2', 'fr line item with id 3' ] }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.0.textContent': 'fr-CA A paragraph with {1} is converted to {2}.' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'fr-CA parameters', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': 'fr-CA ', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.0.textContent': 'fr-CA A paragraph with {1} is converted to {2}.' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'fr-CA id', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': 'fr-CA ', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"]', 'nextTextSibling.data': 'fr-CA outermost text at the end ' } + ]; + var param1 = '1st compound parameter'; + var param2 = '2nd compound parameter'; + var text_compound = { + 'model': {}, + 'text': [ + ' outermost text at the beginning with compound {1} and {2} variables ', + '{{param1}}', + '{{param2}}' + ], + 'h1_3': [ + 'outermost header 1 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'text_4': [ + ' outermost text in the middle with {1} and {2} variables ', + '{{param1}}', + '{{param2}}' + ], + 'span_5': [ + 'simple text without id with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'span_6': [ + 'simple text without id 2 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'label-1': [ + 'simple text with id and {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'label-2': [ + 'simple text with id and {1} and {2} variables 2', + '{{param1}}', + '{{param2}}' + ], + 'div_9:span': [ + 'simple text within div with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_9:span_1': [ + 'simple text within div with {1} and {2} variables 2', + '{{param1}}', + '{{param2}}' + ], + 'div_9:div_2:div': [ + 'great grandchild text within div with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_10:text': [ + ' simple text as the first element in div with {1} and {2} variables ', + '{{param1}}', + '{{param2}}' + ], + 'div_10:span_1': [ + 'simple text within div with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_10:text_2': [ + ' simple text in the middle of div with {1} and {2} variables ', + '{{param1}}', + '{{param2}}' + ], + 'div_10:span_3': [ + 'simple text within div with {1} and {2} variables 2', + '{{param1}}', + '{{param2}}' + ], + 'div_10:div_4:div': [ + 'great grandchild text within div with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_10:text_5': [ + ' simple text at the last element in div with {1} and {2} variables ', + '{{param1}}', + '{{param2}}' + ], + 'toplevel-div:span': [ + 'simple text within div with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'toplevel-div:span_1': [ + 'simple text within div 2 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'third-level-div': [ + 'great grandchild text within div with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'second-level-div:div_1': [ + 'great grandchild text within div without id with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_12:ul:li': [ + 'line item without id 1 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_12:ul:li_1': [ + 'line item without id 2 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_12:ul:li_2': [ + 'line item without id 3 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'line-items:li': [ + 'line item with id 1 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'line-items:li_1': [ + 'line item with id 2 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'line-items:li_2': [ + 'line item with id 3 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'p_13': [ + 'A paragraph with {1} is converted to {2}.', + '{{param1}}', + '{{param2}}' + ], + 'paragraph': [ + 'A paragraph with {1}, {2}, and {3} is converted to {4}.', + 'id', + '{{param1}}', + '{{param2}}', + '' + ], + 'text_15': [ + ' outermost text at the end with {1} and {2} variables ', + '{{param1}}', + '{{param2}}' + ] + }; + var localDOM_compound = [ + { select: 'i18n-format', + 'PolymerDom.children.0.textContent': [ + ' outermost text at the beginning with compound {1} and {2} variables ', + 'outermost header 1 with {1} and {2} variables', + ' outermost text in the middle with {1} and {2} variables ', + 'simple text without id with {1} and {2} variables', + 'simple text without id 2 with {1} and {2} variables', + 'simple text with id and {1} and {2} variables', + 'simple text with id and {1} and {2} variables 2', + 'simple text within div with {1} and {2} variables', + 'simple text within div with {1} and {2} variables 2', + 'great grandchild text within div with {1} and {2} variables', + ' simple text as the first element in div with {1} and {2} variables ', + 'simple text within div with {1} and {2} variables', + ' simple text in the middle of div with {1} and {2} variables ', + 'simple text within div with {1} and {2} variables 2', + 'great grandchild text within div with {1} and {2} variables', + ' simple text at the last element in div with {1} and {2} variables ', + 'simple text within div with {1} and {2} variables', + 'simple text within div 2 with {1} and {2} variables', + 'great grandchild text within div with {1} and {2} variables', + 'great grandchild text within div without id with {1} and {2} variables', + 'line item without id 1 with {1} and {2} variables', + 'line item without id 2 with {1} and {2} variables', + 'line item without id 3 with {1} and {2} variables', + 'line item with id 1 with {1} and {2} variables', + 'line item with id 2 with {1} and {2} variables', + 'line item with id 3 with {1} and {2} variables', + 'A paragraph with {1} is converted to {2}.', + 'A paragraph with {1}, {2}, and {3} is converted to {4}.', + ' outermost text at the end with {1} and {2} variables ' + ], + 'PolymerDom.children.1.textContent.raw': [ + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter' + ], + 'PolymerDom.children.2.textContent.raw': [ + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '1st compound parameter', + '2nd compound parameter' + ] + }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'id', + 'PolymerDom.children.1.attributes.slot.value.raw': '1', + 'PolymerDom.children.3.tagName': 'SPAN', + 'PolymerDom.children.3.textContent.raw': '2nd compound parameter', + 'PolymerDom.children.3.attributes.slot.value.raw': '3' + }, + { select: '[id="paragraph"] +i18n-format', + 'PolymerDom.children.1.textContent.raw': '1st compound parameter' + } + ]; + + var suites = [ + s('simple text default', null, { + fixture: 'simple-text-element-default-fixture', + fixtureModel: undefined, + assign: undefined, + lang: lang1, + effectiveLang: lang1, + templateDefaultLang: lang1, + observeHtmlLang: true, + text: text_simple, + model: {}, + localDOM: localDOM_simple, + lightDOM: undefined + }), + s('commented simple text default', 'simple text default', { + fixture: 'commented-simple-text-element-default-fixture' + }), + s('simple text default null lang', 'simple text default', { + assign: { lang: lang0 }, + lang: lang0, + effectiveLang: lang0 + }), + s('commented simple text default null lang', 'commented simple text default', { + assign: { lang: lang0 }, + lang: lang0, + effectiveLang: lang0 + }), + s(lang2 + ' simple text default', 'simple text default', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang2 + ' commented simple text default', 'commented simple text default', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s('simple text null lang', 'simple text default', { + fixture: 'simple-text-element-fixture', + fixtureModel: { observeHtmlLang: false, lang: lang0 }, + assign: { lang: lang0 }, + lang: lang0, + effectiveLang: lang0, + observeHtmlLang: false + }), + s('simple text', 'simple text null lang', { + assign: { lang: lang1 }, + lang: lang1, + effectiveLang: lang1 + }), + s(lang2 + ' simple text', 'simple text', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang6 + ' simple text', 'simple text', { + assign: { lang: lang6 }, + lang: lang6, + effectiveLang: lang6 + }), + s('commented simple text', 'simple text', { + fixture: 'commented-simple-text-element-fixture' + }), + s('commented simple text null lang', 'commented simple text', { + assign: { lang: lang0 }, + lang: lang0, + effectiveLang: lang0 + }), + s(lang2 + ' commented simple text', 'commented simple text', { + fixtureModel: { observeHtmlLang: false, lang: lang0 }, + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang2 + ' static commented simple text', 'commented simple text', { + fixtureModel: { observeHtmlLang: false, lang: lang2 }, + assign: undefined, + lang: lang2, + effectiveLang: lang2 + }), + s('simple text id', 'simple text', { + fixture: 'simple-text-id-element-fixture', + text: text_simple_text_id, + localDOM: localDOM_simple_text_id + }), + s(lang2 + ' simple text id', 'simple text id', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s('plural gender', 'simple text default', { + fixture: 'plural-gender-element-fixture', + fixtureModel: { + observeHtmlLang: false, + lang: lang0 + }, + assign: { + lang: lang1, + sender: sender1, + recipients: recipients1 + }, + observeHtmlLang: false, + event: 'local-dom-ready', + text: text_plural_gender, + localDOM: localDOM_plural_gender_1 + }), + s('plural gender 2', 'plural gender', { + assign: { + lang: lang1, + sender: sender1, + recipients: recipients2 + }, + localDOM: localDOM_plural_gender_2 + }), + s('plural gender 3', 'plural gender', { + assign: { + lang: lang1, + sender: sender1, + recipients: recipients3 + }, + localDOM: localDOM_plural_gender_3 + }), + s('plural gender 4', 'plural gender', { + assign: { + lang: lang1, + sender: sender1, + recipients: recipients4 + }, + localDOM: localDOM_plural_gender_4 + }), + s(lang2 + ' plural gender', 'plural gender', { + assign: { + lang: lang2, + sender: sender1, + recipients: recipients1 + }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang2 + ' plural gender 2', 'plural gender 2', { + assign: { + lang: lang2, + sender: sender1, + recipients: recipients2 + }, + lang: lang2, + effectiveLang: lang2, + localDOM: localDOM_plural_gender_2 + }), + s(lang2 + ' plural gender 3', 'plural gender 3', { + assign: { + lang: lang2, + sender: sender1, + recipients: recipients3 + }, + lang: lang2, + effectiveLang: lang2, + localDOM: localDOM_plural_gender_3 + }), + s(lang2 + ' plural gender 4', 'plural gender 4', { + assign: { + lang: lang2, + sender: sender1, + recipients: recipients4 + }, + lang: lang2, + effectiveLang: lang2, + localDOM: localDOM_plural_gender_4 + }), + s('simple attribute', 'simple text default', { + fixture: 'simple-attribute-element-fixture', + fixtureModel: { + observeHtmlLang: false, + lang: lang0 + }, + assign: { lang: lang1 }, + observeHtmlLang: false, + text: text_simple_attribute, + model: model_simple_attribute, + localDOM: localDOM_simple_attribute + }), + s(lang2 + ' simple attribute', 'simple attribute', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2, + localDOM: localDOM_simple_attribute_fr + }), + s(lang4 + ' simple text default with fallback to ' + lang2, 'simple text default', { + timeout: 60000, + assign: { lang: lang4 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang4 + ' simple text with fallback to ' + lang2, 'simple text', { + timeout: 60000, + assign: { lang: lang4 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang5 + ' simple text with fallback to default', 'simple text', { + timeout: 60000, + assign: { lang: lang5 }, + lang: lang0, + effectiveLang: lang0 + }), + s(lang3 + ' simple text with fallback to default', 'simple text', { + timeout: 60000, + assign: { lang: lang3 }, + lang: lang0, + effectiveLang: lang0 + }), + s(lang4 + ' fallback text', 'simple text', { + timeout: 60000, + fixture: 'fallback-text-element-fixture', + assign: { lang: lang4 }, + lang: lang4, + effectiveLang: lang4, + rawText: true, + text: text_fallback, + localDOM: localDOM_fallback + }), + s('compound binding', 'simple text', { + fixture: 'compound-binding-element-fixture', + fixtureModel: { + observeHtmlLang: false, + lang: lang0, + param1: param1, + param2: param2 + }, + text: text_compound, + localDOM: localDOM_compound + }), + s(lang2 + ' compound binding', 'compound binding', { + fixtureModel: { + observeHtmlLang: false, + lang: lang0, + param1: param1, + param2: param2 + }, + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s('simple attribute dom bind', 'simple attribute', { + fixture: 'simple-attribute-dom-bind', + fixtureModel: { + observeHtmlLang: false, + lang: lang0 + }, + assign: { lang: lang1 }, + event: 'local-dom-ready', + text: text_simple_attribute, + model: model_simple_attribute, + localDOM: localDOM_simple_attribute + }), + s(lang2 + ' simple attribute dom bind', 'simple attribute dom bind', { + fixtureModel: { + observeHtmlLang: false, + lang: lang0 + }, + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2, + localDOM: localDOM_simple_attribute_fr + }), + s('compound binding dom bind', 'compound binding', { + fixture: 'compound-binding-dom-bind' + }), + s(lang2 + ' compound binding dom bind', 'compound binding dom bind', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang2 + ' default observeHtmlLang simple text dom bind', 'simple text', { + fixture: 'simple-text-dom-bind', + fixtureModel: { + 'html.lang': lang5 + }, + assign: { 'html.lang': lang2 }, + lang: lang2, + effectiveLang: lang2, + text: text_simple, + model: undefined, + localDOM: localDOM_simple, + observeHtmlLang: true + }), + s('simple text dom bind', 'simple text', { + fixture: 'simple-text-dom-bind', + fixtureModel: { + observeHtmlLang: false, + lang: lang0 + }, + text: text_simple, + localDOM: localDOM_simple + }), + s(lang2 + ' simple text dom bind', 'simple text dom bind', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s('html.lang simple text dom bind', 'simple text dom bind', { + fixtureModel: { + observeHtmlLang: true, + lang: lang0, + 'html.lang': lang0 + }, + assign: { 'html.lang': lang1 }, + observeHtmlLang: true + }), + s(lang2 + ' html.lang simple text dom bind', 'html.lang simple text dom bind', { + assign: { 'html.lang': lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s('observeHtmlLang default simple text', 'simple text null lang', { + fixtureModel: { + observeHtmlLang: true + }, + assign: { 'html.lang': lang1 }, + lang: lang1, + effectiveLang: lang1, + observeHtmlLang: true + }) + ]; + + window.dispatchEvent(new CustomEvent('suites-loaded')); + suitesRunner(suites, 100); +}); diff --git a/test/preprocess3/basic-test.html b/test/preprocess3/basic-test.html new file mode 100644 index 00000000..22c8c587 --- /dev/null +++ b/test/preprocess3/basic-test.html @@ -0,0 +1,303 @@ + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/preprocess3/commented-simple-text-element/commented-simple-text-element.js b/test/preprocess3/commented-simple-text-element/commented-simple-text-element.js new file mode 100644 index 00000000..90ad29f4 --- /dev/null +++ b/test/preprocess3/commented-simple-text-element/commented-simple-text-element.js @@ -0,0 +1,435 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class CommentedSimpleTextElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +{{text.text}} +
+   +

{{text.h1_3}}

{{text.text_4}} + {{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+ +
{{text.div_10:text}} + {{text.div_10:span_1}}{{text.div_10:text_2}} + {{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} + +`); + } + + static get is() { return 'commented-simple-text-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(CommentedSimpleTextElement.is, CommentedSimpleTextElement); + } + break; +case 'base-element': + { + class CommentedSimpleTextElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +{{text.text}} +
+   +

{{text.h1_3}}

{{text.text_4}} + {{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+ +
{{text.div_10:text}} + {{text.div_10:span_1}}{{text.div_10:text_2}} + {{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} + +`); + } + + static get is() { return 'commented-simple-text-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(CommentedSimpleTextElement.is, CommentedSimpleTextElement); + } + break; +case 'thin': + { + Define = class CommentedSimpleTextElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + }; + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +{{text.text}} +
+   +

{{text.h1_3}}

{{text.text_4}} + {{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+ +
{{text.div_10:text}} + {{text.div_10:span_1}}{{text.div_10:text_2}} + {{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} + +`), + + is: 'commented-simple-text-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + listeners: { + 'lang-updated': '_langUpdated' + }, + + ready: function () { + //this.observeHtmlLang = false; + }, + + attached: function () { + }, + + _langUpdated: function (e) { + console.log(this.is, 'lang-updated', e.detail); + if (dom(e).rootTarget === this) { + this.model = deepcopy(this.text.model); + } + } + }); + } + break; +} diff --git a/test/preprocess3/commented-simple-text-element/commented-simple-text-element.json b/test/preprocess3/commented-simple-text-element/commented-simple-text-element.json new file mode 100644 index 00000000..f9b2ccf7 --- /dev/null +++ b/test/preprocess3/commented-simple-text-element/commented-simple-text-element.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "model": {}, + "text": " outermost text at the beginning ", + "h1_3": "outermost header 1", + "text_4": " outermost text in the middle ", + "span_5": "simple text without id", + "span_6": "simple text without id 2", + "label-1": "simple text with id", + "label-2": "simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "simple text within div", + "toplevel-div:span_1": "simple text within div 2", + "third-level-div": "great grandchild text within div", + "second-level-div:div_1": "great grandchild text within div without id", + "div_12:ul:li": "line item without id 1", + "div_12:ul:li_1": "line item without id 2", + "div_12:ul:li_2": "line item without id 3", + "line-items:li": "line item with id 1", + "line-items:li_1": "line item with id 2", + "line-items:li_2": "line item with id 3", + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "parameters", + "" + ], + "paragraph": [ + "A paragraph with {1} is converted to {2}.", + "id", + "" + ], + "text_15": " outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/commented-simple-text-element/locales/commented-simple-text-element.fr.json b/test/preprocess3/commented-simple-text-element/locales/commented-simple-text-element.fr.json new file mode 100755 index 00000000..d993e702 --- /dev/null +++ b/test/preprocess3/commented-simple-text-element/locales/commented-simple-text-element.fr.json @@ -0,0 +1,43 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "text": " fr outermost text at the beginning ", + "h1_3": "fr outermost header 1", + "text_4": " fr outermost text in the middle ", + "span_5": "fr simple text without id", + "span_6": "fr simple text without id 2", + "label-1": "fr simple text with id", + "label-2": "fr simple text with id 2", + "div_9:span": "fr simple text within div", + "div_9:span_1": "fr simple text within div 2", + "div_9:div_2:div": "fr great grandchild text within div", + "div_10:text": " fr simple text as the first element in div ", + "div_10:span_1": "fr simple text within div", + "div_10:text_2": " fr simple text in the middle of div ", + "div_10:span_3": "fr simple text within div 2", + "div_10:div_4:div": "fr great grandchild text within div", + "div_10:text_5": " fr simple text at the last element in div ", + "toplevel-div:span": "fr simple text within div", + "toplevel-div:span_1": "fr simple text within div 2", + "third-level-div": "fr great grandchild text within div", + "second-level-div:div_1": "fr great grandchild text within div without id", + "div_12:ul:li": "fr line item without id 1", + "div_12:ul:li_1": "fr line item without id 2", + "div_12:ul:li_2": "fr line item without id 3", + "line-items:li": "fr line item with id 1", + "line-items:li_1": "fr line item with id 2", + "line-items:li_2": "fr line item with id 3", + "p_13": [ + "fr A paragraph with {1} is converted to {2}.", + "fr parameters", + "fr " + ], + "paragraph": [ + "fr A paragraph with {1} is converted to {2}.", + "fr id", + "fr " + ], + "text_15": " fr outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/compound-binding-dom-bind.json b/test/preprocess3/compound-binding-dom-bind.json new file mode 100644 index 00000000..87338aff --- /dev/null +++ b/test/preprocess3/compound-binding-dom-bind.json @@ -0,0 +1,151 @@ +{ + "meta": {}, + "model": {}, + "text": [ + " outermost text at the beginning with compound {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "h1_3": [ + "outermost header 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "text_4": [ + " outermost text in the middle with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "span_5": [ + "simple text without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "span_6": [ + "simple text without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-1": [ + "simple text with id and {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-2": [ + "simple text with id and {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:span": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_9:span_1": [ + "simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:div_2:div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text": [ + " simple text as the first element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_1": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_2": [ + " simple text in the middle of div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_3": [ + "simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_10:div_4:div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_5": [ + " simple text at the last element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span_1": [ + "simple text within div 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "third-level-div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "second-level-div:div_1": [ + "great grandchild text within div without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li": [ + "line item without id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_1": [ + "line item without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_2": [ + "line item without id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li": [ + "line item with id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_1": [ + "line item with id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_2": [ + "line item with id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "{{param1}}", + "{{param2}}" + ], + "paragraph": [ + "A paragraph with {1}, {2}, and {3} is converted to {4}.", + "id", + "{{param1}}", + "{{param2}}", + "" + ], + "text_15": [ + " outermost text at the end with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ] +} \ No newline at end of file diff --git a/test/preprocess3/compound-binding-element/compound-binding-element.js b/test/preprocess3/compound-binding-element/compound-binding-element.js new file mode 100644 index 00000000..8e43f4d7 --- /dev/null +++ b/test/preprocess3/compound-binding-element/compound-binding-element.js @@ -0,0 +1,791 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class CompoundBindingElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text.0}}{{param1}}{{param2}}
+   +

{{text.h1_3.0}}{{param1}}{{param2}}

{{text.text_4.0}}{{param1}}{{param2}}{{text.span_5.0}}{{param1}}{{param2}} + {{text.span_6.0}}{{param1}}{{param2}} + {{text.label-1.0}}{{param1}}{{param2}} + {{text.label-2.0}}{{param1}}{{param2}} +
+ {{text.div_9:span.0}}{{param1}}{{param2}} + {{text.div_9:span_1.0}}{{param1}}{{param2}} +
{{text.div_9:div_2:div.0}}{{param1}}{{param2}}
+
+
{{text.div_10:text.0}}{{param1}}{{param2}}{{text.div_10:span_1.0}}{{param1}}{{param2}}{{text.div_10:text_2.0}}{{param1}}{{param2}}{{text.div_10:span_3.0}}{{param1}}{{param2}} +
{{text.div_10:div_4:div.0}}{{param1}}{{param2}}
{{text.div_10:text_5.0}}{{param1}}{{param2}}
+
+ {{text.toplevel-div:span.0}}{{param1}}{{param2}} + {{text.toplevel-div:span_1.0}}{{param1}}{{param2}} +
+
{{text.third-level-div.0}}{{param1}}{{param2}}
+
{{text.second-level-div:div_1.0}}{{param1}}{{param2}}
+
+
+
+
    +
  • {{text.div_12:ul:li.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_2.0}}{{param1}}{{param2}}
  • +
+
    +
  • {{text.line-items:li.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_2.0}}{{param1}}{{param2}}
  • +
+
+

{{text.p_13.0}}{{param1}}{{param2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{param1}}{{param2}}{{text.paragraph.4}}

{{text.text_15.0}}{{param1}}{{param2}} +`); + } + + static get is() { return 'compound-binding-element' } + static get properties () { + return { + param1: { + type: String, + value: 'parameter 1' + }, + param2: { + type: String, + value: 'parameter 2' + } + }; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(CompoundBindingElement.is, CompoundBindingElement); + } + break; +case 'base-element': + { + class CompoundBindingElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text.0}}{{param1}}{{param2}}
+   +

{{text.h1_3.0}}{{param1}}{{param2}}

{{text.text_4.0}}{{param1}}{{param2}}{{text.span_5.0}}{{param1}}{{param2}} + {{text.span_6.0}}{{param1}}{{param2}} + {{text.label-1.0}}{{param1}}{{param2}} + {{text.label-2.0}}{{param1}}{{param2}} +
+ {{text.div_9:span.0}}{{param1}}{{param2}} + {{text.div_9:span_1.0}}{{param1}}{{param2}} +
{{text.div_9:div_2:div.0}}{{param1}}{{param2}}
+
+
{{text.div_10:text.0}}{{param1}}{{param2}}{{text.div_10:span_1.0}}{{param1}}{{param2}}{{text.div_10:text_2.0}}{{param1}}{{param2}}{{text.div_10:span_3.0}}{{param1}}{{param2}} +
{{text.div_10:div_4:div.0}}{{param1}}{{param2}}
{{text.div_10:text_5.0}}{{param1}}{{param2}}
+
+ {{text.toplevel-div:span.0}}{{param1}}{{param2}} + {{text.toplevel-div:span_1.0}}{{param1}}{{param2}} +
+
{{text.third-level-div.0}}{{param1}}{{param2}}
+
{{text.second-level-div:div_1.0}}{{param1}}{{param2}}
+
+
+
+
    +
  • {{text.div_12:ul:li.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_2.0}}{{param1}}{{param2}}
  • +
+
    +
  • {{text.line-items:li.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_2.0}}{{param1}}{{param2}}
  • +
+
+

{{text.p_13.0}}{{param1}}{{param2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{param1}}{{param2}}{{text.paragraph.4}}

{{text.text_15.0}}{{param1}}{{param2}} +`); + } + + static get is() { return 'compound-binding-element' } + static get properties () { + return { + param1: { + type: String, + value: 'parameter 1' + }, + param2: { + type: String, + value: 'parameter 2' + } + } + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(CompoundBindingElement.is, CompoundBindingElement); + } + break; +case 'thin': + { + Define = class CompoundBindingElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + static get properties () { + return { + param1: { + type: String, + value: 'parameter 1' + }, + param2: { + type: String, + value: 'parameter 2' + } + } + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + }; + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text.0}}{{param1}}{{param2}}
+   +

{{text.h1_3.0}}{{param1}}{{param2}}

{{text.text_4.0}}{{param1}}{{param2}}{{text.span_5.0}}{{param1}}{{param2}} + {{text.span_6.0}}{{param1}}{{param2}} + {{text.label-1.0}}{{param1}}{{param2}} + {{text.label-2.0}}{{param1}}{{param2}} +
+ {{text.div_9:span.0}}{{param1}}{{param2}} + {{text.div_9:span_1.0}}{{param1}}{{param2}} +
{{text.div_9:div_2:div.0}}{{param1}}{{param2}}
+
+
{{text.div_10:text.0}}{{param1}}{{param2}}{{text.div_10:span_1.0}}{{param1}}{{param2}}{{text.div_10:text_2.0}}{{param1}}{{param2}}{{text.div_10:span_3.0}}{{param1}}{{param2}} +
{{text.div_10:div_4:div.0}}{{param1}}{{param2}}
{{text.div_10:text_5.0}}{{param1}}{{param2}}
+
+ {{text.toplevel-div:span.0}}{{param1}}{{param2}} + {{text.toplevel-div:span_1.0}}{{param1}}{{param2}} +
+
{{text.third-level-div.0}}{{param1}}{{param2}}
+
{{text.second-level-div:div_1.0}}{{param1}}{{param2}}
+
+
+
+
    +
  • {{text.div_12:ul:li.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_2.0}}{{param1}}{{param2}}
  • +
+
    +
  • {{text.line-items:li.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_2.0}}{{param1}}{{param2}}
  • +
+
+

{{text.p_13.0}}{{param1}}{{param2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{param1}}{{param2}}{{text.paragraph.4}}

{{text.text_15.0}}{{param1}}{{param2}} +`), + + is: 'compound-binding-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + properties: { + param1: { + type: String, + value: 'parameter 1' + }, + param2: { + type: String, + value: 'parameter 2' + } + }, + + listeners: { + 'lang-updated': '_langUpdated' + }, + + ready: function () { + //this.observeHtmlLang = false; + }, + + attached: function () { + }, + + _langUpdated: function (e) { + console.log(this.is, 'lang-updated', e.detail); + if (dom(e).rootTarget === this) { + this.model = deepcopy(this.text.model); + } + } + }); + } + break; +} diff --git a/test/preprocess3/compound-binding-element/compound-binding-element.json b/test/preprocess3/compound-binding-element/compound-binding-element.json new file mode 100644 index 00000000..87338aff --- /dev/null +++ b/test/preprocess3/compound-binding-element/compound-binding-element.json @@ -0,0 +1,151 @@ +{ + "meta": {}, + "model": {}, + "text": [ + " outermost text at the beginning with compound {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "h1_3": [ + "outermost header 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "text_4": [ + " outermost text in the middle with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "span_5": [ + "simple text without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "span_6": [ + "simple text without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-1": [ + "simple text with id and {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-2": [ + "simple text with id and {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:span": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_9:span_1": [ + "simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:div_2:div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text": [ + " simple text as the first element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_1": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_2": [ + " simple text in the middle of div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_3": [ + "simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_10:div_4:div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_5": [ + " simple text at the last element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span_1": [ + "simple text within div 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "third-level-div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "second-level-div:div_1": [ + "great grandchild text within div without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li": [ + "line item without id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_1": [ + "line item without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_2": [ + "line item without id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li": [ + "line item with id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_1": [ + "line item with id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_2": [ + "line item with id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "{{param1}}", + "{{param2}}" + ], + "paragraph": [ + "A paragraph with {1}, {2}, and {3} is converted to {4}.", + "id", + "{{param1}}", + "{{param2}}", + "" + ], + "text_15": [ + " outermost text at the end with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ] +} \ No newline at end of file diff --git a/test/preprocess3/compound-binding-element/locales/compound-binding-element.fr.json b/test/preprocess3/compound-binding-element/locales/compound-binding-element.fr.json new file mode 100755 index 00000000..fef07d0a --- /dev/null +++ b/test/preprocess3/compound-binding-element/locales/compound-binding-element.fr.json @@ -0,0 +1,153 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "text": [ + " fr outermost text at the beginning with compound {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "h1_3": [ + "fr outermost header 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "text_4": [ + " fr outermost text in the middle with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "span_5": [ + "fr simple text without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "span_6": [ + "fr simple text without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-1": [ + "fr simple text with id and {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-2": [ + "fr simple text with id and {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:span": [ + "fr simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_9:span_1": [ + "fr simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:div_2:div": [ + "fr great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text": [ + " fr simple text as the first element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_1": [ + "fr simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_2": [ + " fr simple text in the middle of div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_3": [ + "fr simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_10:div_4:div": [ + "fr great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_5": [ + " fr simple text at the last element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span": [ + "fr simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span_1": [ + "fr simple text within div 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "third-level-div": [ + "fr great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "second-level-div:div_1": [ + "fr great grandchild text within div without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li": [ + "fr line item without id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_1": [ + "fr line item without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_2": [ + "fr line item without id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li": [ + "fr line item with id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_1": [ + "fr line item with id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_2": [ + "fr line item with id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "p_13": [ + "fr A paragraph with {1} is converted to {2}.", + "{{param1}}", + "{{param2}}" + ], + "paragraph": [ + "fr A paragraph with {1}, {2}, and {3} is converted to {4}.", + "fr id", + "{{param1}}", + "{{param2}}", + "fr " + ], + "text_15": [ + " fr outermost text at the end with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ] +} \ No newline at end of file diff --git a/test/preprocess3/edge-case-dom-bind.json b/test/preprocess3/edge-case-dom-bind.json new file mode 100644 index 00000000..4577c44d --- /dev/null +++ b/test/preprocess3/edge-case-dom-bind.json @@ -0,0 +1,29 @@ +{ + "meta": {}, + "model": {}, + "text": [ + " name = {1} ", + "{{text.name}}" + ], + "i18n-number_1": "1", + "i18n-format_2": [ + "{{text.format}}", + "1" + ], + "i18n-format_3": [ + "format", + "" + ], + "p_8": [ + "hello {1}{2} {3} world", + "
", + "", + "" + ], + "p_9": [ + "hello{1}world", + "
" + ], + "text_10": " hello ", + "text_14": " world " +} \ No newline at end of file diff --git a/test/preprocess3/edge-case-test-imports.js b/test/preprocess3/edge-case-test-imports.js new file mode 100644 index 00000000..98ccfbf3 --- /dev/null +++ b/test/preprocess3/edge-case-test-imports.js @@ -0,0 +1,25 @@ +import './fake-server.js'; +import './test-runner.js'; +import '../../i18n-element.js'; +import '../../define-element.js'; +import '../../i18n-dom-bind.js'; +import './edge-case/empty-element.js'; +import './edge-case/no-template-element.js'; +import './edge-case/complex-compound-binding-element.js'; +import './edge-case/advanced-binding-element.js'; +import './edge-case-test-suites.js'; + +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +/* + + +*/ +/* + FIXME(polymer-modulizer): the above comments were extracted + from HTML and may be out of place here. Review them and + then delete this comment! +*/ +; diff --git a/test/preprocess3/edge-case-test-suites.js b/test/preprocess3/edge-case-test-suites.js new file mode 100644 index 00000000..a04027fb --- /dev/null +++ b/test/preprocess3/edge-case-test-suites.js @@ -0,0 +1,411 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import './test-runner.js'; +suite('I18nElement with ' + + (window.location.href.indexOf('?dom=Shadow') >= 0 ? 'Shadow DOM' : 'Shady DOM') + + (' in ' + syntax + ' syntax'), + function () { + + var lang0 = ''; + var lang1 = 'en'; + var lang2 = 'fr'; + var lang3 = 'ja'; + var lang4 = 'fr-CA'; + var lang5 = 'zh-Hans-CN'; + var lang6 = 'ru'; + var lang7 = 'zh-yue-Hans-CN'; + var lang8 = 'zh-CN'; + var lang9 = 'zh-TW'; + var lang10 = 'zh-Hans-CN-x-Linux'; + var text_complex_compound_binding = { + 'model': {}, + 'item-update2:text': [ + 'updated: {1}, by: ', + '{{text.updated}}' + ], + 'item-update2:text_2': ' xxx ', + 'item-update2:dom-if_3:template:span:b': 'IF CONTENT', + 'item-update2:b_4': 'abc', + 'item-update2:dom-if_5:template:text': 'IF CONTENT 2', + 'item-update2:text_6': ' hello ', + 'item-update:text': [ + 'updated: {1}, by: ', + '{{text.updated}}' + ], + 'item-update:text_2': ' xxx ', + 'item-update:dom-if_3:template:b': 'IF CONTENT', + 'item-update:b_4': 'abc', + 'item-update:dom-if_5:template:text': 'IF CONTENT 2', + 'item-update:text_6': ' hello ', + 'item-update3:text': [ + 'updated: {1}, by: ', + '{{text.updated}}' + ], + 'item-update3:text_2': ' xxx ', + 'item-update3:dom-if_3:template:b': 'IF', + 'item-update3:dom-if_3:template:b_1': 'CONTENT', + 'item-update3:b_4': 'abc', + 'item-update3:dom-if_5:template:text': 'IF CONTENT 2', + 'item-update3:text_6': ' hello ', + 'item-update4:text': [ + 'updated: {1}, by: ', + '{{text.updated}}' + ], + 'item-update4:dom-repeat_1:template:text': [ + ' {1} = {2} ', + '{{item.name}}', + '{{text.updated}}' + ], + 'item-update4:text_2': ' xxx ', + 'item-update4:dom-if_3:template:b': 'IF CONTENT', + 'item-update4:b_4': 'abc', + 'item-update4:dom-if_5:template:text': 'IF CONTENT 2', + 'item-update4:text_6': ' hello ', + 'paragraph:text': 'A paragraph with ', + 'paragraph:text_2': ' is converted to ', + 'paragraph:code_3': '', + 'paragraph:text_4': '. ', + 'paragraph2:text': 'A paragraph with deep ', + 'paragraph2:text_2': ' is ', + 'paragraph2:b_3': 'not', + 'paragraph2:text_4': ' converted to ', + 'paragraph2:code_5': '', + 'paragraph2:text_6': '. ', + 'authors': [ + { + 'name': 'Joe' + }, + { + 'name': 'Alice' + } + ], + 'updated': 'Jan 1st, 2016', + 'parameters': [ + 'parameter 1', + 'parameter 2' + ] + }; + var localDOM_complex_compound_binding = [ + { select: '[id="item-update"] i18n-format', + 'PolymerDom.childNodes.nonWS.0.textContent': text_complex_compound_binding['item-update:text'][0], + 'root.PolymerDom.effectiveChildNodes.nonWS.0.textContent': 'updated: ', + 'root.PolymerDom.effectiveChildNodes.nonWS.1.textContent.trim': text_complex_compound_binding.updated, + 'root.PolymerDom.effectiveChildNodes.nonWS.2.textContent.raw': ', by: ' + }, + { select: '[id="item-update"]', + 'PolymerDom.childNodes.nonWS.1.textContent.trim': text_complex_compound_binding.authors[0].name, + 'PolymerDom.childNodes.nonWS.2.textContent.trim': text_complex_compound_binding.authors[1].name, + 'PolymerDom.childNodes.nonWS.3.tagName': 'DOM-REPEAT', + 'PolymerDom.childNodes.nonWS.4.textContent': text_complex_compound_binding['item-update:text_2'], + 'PolymerDom.childNodes.nonWS.5.textContent.trim': text_complex_compound_binding['item-update:dom-if_3:template:b'], + 'PolymerDom.childNodes.nonWS.6.tagName': 'DOM-IF', + 'PolymerDom.childNodes.nonWS.7.textContent.trim': text_complex_compound_binding['item-update:b_4'], + 'PolymerDom.childNodes.nonWS.8.textContent.trim': text_complex_compound_binding['item-update:dom-if_5:template:text'], + 'PolymerDom.childNodes.nonWS.9.tagName': 'DOM-IF', + 'PolymerDom.childNodes.nonWS.10.textContent': text_complex_compound_binding['item-update:text_6'] + }, + { select: '[id="item-update2"] i18n-format', + 'PolymerDom.childNodes.nonWS.0.textContent': text_complex_compound_binding['item-update2:text'][0], + 'root.PolymerDom.effectiveChildNodes.nonWS.1.textContent.trim': text_complex_compound_binding.updated, + 'root.PolymerDom.effectiveChildNodes.nonWS.2.textContent.raw': ', by: ' + }, + { select: '[id="item-update2"]', + 'PolymerDom.childNodes.nonWS.1.data.trim': text_complex_compound_binding.authors[0].name, + 'PolymerDom.childNodes.nonWS.2.data.trim': text_complex_compound_binding.authors[1].name, + 'PolymerDom.childNodes.nonWS.3.tagName': 'DOM-REPEAT', + 'PolymerDom.childNodes.nonWS.4.textContent': text_complex_compound_binding['item-update2:text_2'], + 'PolymerDom.childNodes.nonWS.5.childNodes.nonWS.0.textContent.trim': text_complex_compound_binding['item-update2:dom-if_3:template:span:b'], + 'PolymerDom.childNodes.nonWS.6.tagName': 'DOM-IF', + 'PolymerDom.childNodes.nonWS.7.textContent.trim': text_complex_compound_binding['item-update2:b_4'], + 'PolymerDom.childNodes.nonWS.8.data': text_complex_compound_binding['item-update2:dom-if_5:template:text'], + 'PolymerDom.childNodes.nonWS.9.tagName': 'DOM-IF', + 'PolymerDom.childNodes.nonWS.10.data': ' hello ' + }, + { select: '[id="item-update3"]', + 'PolymerDom.childNodes.nonWS.1.data.trim': text_complex_compound_binding.authors[0].name, + 'PolymerDom.childNodes.nonWS.2.data.trim': text_complex_compound_binding.authors[1].name, + 'PolymerDom.childNodes.nonWS.3.tagName': 'DOM-REPEAT', + 'PolymerDom.childNodes.nonWS.4.textContent': text_complex_compound_binding['item-update3:text_2'], + 'PolymerDom.childNodes.nonWS.5.childNodes.nonWS.0.textContent.trim': text_complex_compound_binding['item-update3:dom-if_3:template:b'], + 'PolymerDom.childNodes.nonWS.6.childNodes.nonWS.0.textContent.trim': text_complex_compound_binding['item-update3:dom-if_3:template:b_1'], + 'PolymerDom.childNodes.nonWS.7.tagName': 'DOM-IF', + 'PolymerDom.childNodes.nonWS.8.textContent.trim': text_complex_compound_binding['item-update3:b_4'], + 'PolymerDom.childNodes.nonWS.9.data': text_complex_compound_binding['item-update3:dom-if_5:template:text'], + 'PolymerDom.childNodes.nonWS.10.tagName': 'DOM-IF', + 'PolymerDom.childNodes.nonWS.11.data': ' hello ' + }, + { select: '[id="item-update4"] i18n-format', + 'PolymerDom.childNodes.nonWS.0.textContent': text_complex_compound_binding['item-update4:text'][0], + 'root.PolymerDom.effectiveChildNodes.nonWS.1.textContent.trim': text_complex_compound_binding.updated, + 'root.PolymerDom.effectiveChildNodes.nonWS.2.textContent.raw': ', by: ' + }, + { select: '[id="item-update4"] i18n-format +i18n-format', + 'PolymerDom.childNodes.nonWS.0.textContent': text_complex_compound_binding['item-update4:dom-repeat_1:template:text'][0], + 'PolymerDom.childNodes.nonWS.1.textContent.trim': text_complex_compound_binding.authors[0].name, + 'PolymerDom.childNodes.nonWS.2.textContent.trim': text_complex_compound_binding.updated + }, + { select: '[id="item-update4"] i18n-format +i18n-format +i18n-format', + 'PolymerDom.childNodes.nonWS.0.textContent': text_complex_compound_binding['item-update4:dom-repeat_1:template:text'][0], + 'PolymerDom.childNodes.nonWS.1.textContent.trim': text_complex_compound_binding.authors[1].name, + 'PolymerDom.childNodes.nonWS.2.textContent.trim': text_complex_compound_binding.updated + }, + { select: '[id="item-update4"] dom-repeat', + 'tagName': [ 'DOM-REPEAT' ] + }, + { select: '[id="item-update4"] dom-if', + 'tagName': [ 'DOM-IF', 'DOM-IF' ] + }, + { select: '[id="item-update4"] dom-repeat', + 'nextTextSibling.data': text_complex_compound_binding['item-update4:text_2'] + }, + { select: '[id="item-update4"] b', + 'PolymerDom.textContent': [ text_complex_compound_binding['item-update4:dom-if_3:template:b'], text_complex_compound_binding['item-update4:b_4'] ] + }, + { select: '[id="item-update4"]', + 'PolymerDom.childNodes.nonWS.8.data': text_complex_compound_binding['item-update4:dom-if_5:template:text'], + 'PolymerDom.childNodes.nonWS.10.data': ' hello ' + }, + { select: '[id="paragraph"]', + 'PolymerDom.childNodes.nonWS.0.textContent': text_complex_compound_binding['paragraph:text'], + 'PolymerDom.childNodes.nonWS.1.textContent.trim': text_complex_compound_binding.parameters[0], + 'PolymerDom.childNodes.nonWS.2.textContent.trim': text_complex_compound_binding.parameters[1], + }, + { select: '[id="paragraph"] code', + 'tagName': 'CODE', + 'textContent': text_complex_compound_binding['paragraph:code_3'] + }, + { select: '[id="paragraph2"]', + 'PolymerDom.childNodes.nonWS.0.data': text_complex_compound_binding['paragraph2:text'] + }, + { select: '[id="paragraph2"] span i', + 'textContent': text_complex_compound_binding.parameters + }, + { select: '[id="paragraph2"] b', + 'textContent': text_complex_compound_binding['paragraph2:b_3'], + 'previousTextSibling.data': text_complex_compound_binding['paragraph2:text_2'], + 'nextTextSibling.data': text_complex_compound_binding['paragraph2:text_4'] + }, + { select: '[id="paragraph2"] code', + 'textContent': text_complex_compound_binding['paragraph2:code_5'], + 'nextTextSibling.data': text_complex_compound_binding['paragraph2:text_6'] + }, + ]; + var text_advanced_binding = { + 'meta': {}, + 'model': { + 'aria-attributes': { + 'title': 'tooltip text', + 'aria-label': 'aria label text', + 'aria-valuetext': 'aria value text' + } + }, + 'annotated-format': [ + '{{tr(status,text.statusMessageFormats)}}', + '{{parameter}}', + 'string parameter' + ], + 'span_5': [ + '{1} {2}', + '{{text.defaultValue}}', + '{{text.defaultValue}}' + ], + 'statusMessages': { + 'ok': 'healthy status', + 'busy': 'busy status', + 'error': 'error status', + 'default': 'unknown status' + }, + 'defaultValue': 'default value', + 'statusMessageFormats': { + 'ok': 'healthy status', + 'busy': 'busy status with {2}', + 'error': 'error status with {1} and {2}', + 'default': 'unknown status' + }, + 'nodefault': { + 'ok': 'ok status' + } + }; + var localDOM_advanced_binding_1 = [ + { select: '[id="status"]', textContent: 'healthy status' }, + { select: '[id="default"]', 'textContent.raw': 'initial value' }, + { select: '[id="annotated-format"]', + 'root.PolymerDom.textContent': 'healthy status' }, + { select: '[id="aria-attributes"]', + 'attributes.title.value.text': 'tooltip text', + 'attributes.aria-label.value.text': 'aria label text', + 'attributes.aria-valuetext.value.text': 'aria value text', + 'bindValue.raw': 'initial value' } + ]; + var localDOM_advanced_binding_2 = [ + { select: '[id="status"]', textContent: 'busy status' }, + { select: '[id="default"]', textContent: 'default value' }, + { select: '[id="annotated-format"]', + 'root.PolymerDom.effectiveChildNodes.nonWS.0.textContent': 'busy status with ', + 'root.PolymerDom.effectiveChildNodes.nonWS.1.textContent': 'string parameter' }, + { select: '[id="aria-attributes"]', + 'attributes.title.value.text': 'tooltip text', + 'attributes.aria-label.value.text': 'aria label text', + 'attributes.aria-valuetext.value.text': 'aria value text', + 'bindValue.raw': '' } + ]; + var localDOM_advanced_binding_3 = [ + { select: '[id="status"]', textContent: 'error status' }, + { select: '[id="default"]', textContent: 'default value' }, + { select: '[id="annotated-format"]', + 'root.PolymerDom.effectiveChildNodes.nonWS.0.textContent': 'error status with ', + 'root.PolymerDom.effectiveChildNodes.nonWS.1.textContent.raw': 'parameter text', + 'root.PolymerDom.effectiveChildNodes.nonWS.2.textContent.raw': ' and ', + 'root.PolymerDom.effectiveChildNodes.nonWS.3.textContent': 'string parameter' }, + { select: '[id="aria-attributes"]', + 'attributes.title.value.text': 'tooltip text', + 'attributes.aria-label.value.text': 'aria label text', + 'attributes.aria-valuetext.value.text': 'aria value text', + 'bindValue.raw': null } + ]; + var localDOM_advanced_binding_4 = [ + { select: '[id="status"]', textContent: 'unknown status' }, + { select: '[id="default"]', textContent: 'default value' }, + { select: '[id="annotated-format"]', + 'root.PolymerDom.effectiveChildNodes.nonWS.0.textContent': 'unknown status' }, + { select: '[id="aria-attributes"]', + 'attributes.title.value.text': 'tooltip text', + 'attributes.aria-label.value.text': 'aria label text', + 'attributes.aria-valuetext.value.text': 'aria value text', + 'bindValue.raw': undefined } + ]; + + var suites = [ + s('empty element', null, { + fixture: 'empty-element-fixture', + fixtureModel: undefined, + assign: undefined, + lang: lang1, + effectiveLang: lang1, + templateDefaultLang: lang1, + observeHtmlLang: true, + //text: { model: {} }, + model: {}, + localDOM: undefined, + lightDOM: undefined + }), + s(lang2 + ' empty element', 'empty element', { + fixture: 'bound-empty-element-fixture', + fixtureModel: { observeHtmlLang: false, lang: lang1 }, + assign: { lang: lang2 }, + event: 'lang-updated', + lang: lang2, + effectiveLang: lang2, + observeHtmlLang: false + }), + s('no template element', 'empty element', { + fixture: 'no-template-element-fixture' + }), + s('complex compound binding element', 'empty element', { + setup: true, + fixture: 'complex-compound-binding-element-fixture', + fixtureModel: { observeHtmlLang: false, lang: lang0 }, + assign: { lang: lang1 }, + event: 'local-dom-ready', + lang: lang1, + effectiveLang: lang1, + observeHtmlLang: false, + text: text_complex_compound_binding, + localDOM: localDOM_complex_compound_binding + }), + s(lang2 + ' complex compound binding element', 'complex compound binding element', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s('advanced binding element', 'empty element', { + setup: true, + fixture: 'advanced-binding-element-fixture', + fixtureModel: { + observeHtmlLang: false, + lang: lang0, + status: 'ok', + value: 'initial value', + parameter: 'parameter text' + }, + assign: { lang: lang1 }, + event: 'local-dom-ready', + lang: lang1, + effectiveLang: lang1, + observeHtmlLang: false, + text: text_advanced_binding, + model: text_advanced_binding.model, + localDOM: localDOM_advanced_binding_1 + }), + s('advanced binding element 2', 'advanced binding element', { + fixtureModel: { + observeHtmlLang: false, + lang: lang0, + status: 'busy', + value: '', + parameter: 'parameter text' + }, + localDOM: localDOM_advanced_binding_2 + }), + s('advanced binding element 3', 'advanced binding element', { + fixtureModel: { + observeHtmlLang: false, + lang: lang0, + status: 'error', + value: null, + parameter: 'parameter text' + }, + localDOM: localDOM_advanced_binding_3 + }), + s('advanced binding element 4', 'advanced binding element', { + fixtureModel: { + observeHtmlLang: false, + lang: lang0, + status: null, + value: undefined, + parameter: 'parameter text' + }, + localDOM: localDOM_advanced_binding_4 + }), + s(lang2 + ' advanced binding element', 'advanced binding element', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang2 + ' advanced binding element 2', 'advanced binding element 2', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang2 + ' advanced binding element 3', 'advanced binding element 3', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang2 + ' advanced binding element 4', 'advanced binding element 4', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang7 + ' fallback', 'advanced binding element 4', { + timeout: 60000, + assign: { lang: lang7 }, + lang: lang0, + effectiveLang: lang0 + }), + s(lang8 + ' fallback', lang7 + ' fallback', { + assign: { lang: lang8 } + }), + s(lang9 + ' fallback', lang7 + ' fallback', { + assign: { lang: lang9 } + }), + s(lang10 + ' fallback', lang7 + ' fallback', { + assign: { lang: lang10 } + }), + ]; + + suitesRunner(suites); + +}); diff --git a/test/preprocess3/edge-case-test.html b/test/preprocess3/edge-case-test.html new file mode 100644 index 00000000..4c0c2e32 --- /dev/null +++ b/test/preprocess3/edge-case-test.html @@ -0,0 +1,121 @@ + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + \ No newline at end of file diff --git a/test/preprocess3/edge-case/advanced-binding-element.js b/test/preprocess3/edge-case/advanced-binding-element.js new file mode 100644 index 00000000..403cdb36 --- /dev/null +++ b/test/preprocess3/edge-case/advanced-binding-element.js @@ -0,0 +1,541 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import '@polymer/iron-input/iron-input.js'; +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class AdvancedBindingElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + {{tr(status,text.statusMessages)}} + + {{or(value,text.defaultValue)}} + + + {{tr(status,text.statusMessageFormats)}} + {{parameter}} + {{text.annotated-format.2}} + + + + + {{tr('key',text.nodefault)}} + {{text.span_5.0}}{{text.defaultValue}}{{text.defaultValue}} + + + +`); + } + + static get is() { return 'advanced-binding-element' } + static get properties () { + return { + status: { + type: String, + value: 'ok' + }, + value: { + type: String + }, + parameter: { + type: String + } + } + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + this.addEventListener('rendered', this._rendered); + super.ready(); + } + + connectedCallback() { + //console.log('advanced-binding-element: connected'); + super.connectedCallback(); + } + + disconnectedCallback() { + super.disconnectedCallback(); + //console.log('advanced-binding-element: disconnected'); + } + + _langUpdated(e) { + console.log('lang-updated', e.composedPath()[0], e.target, e.detail, 'lang = ' + this.lang, 'effectiveLang = ' + this.effectiveLang); + if (e.composedPath()[0] === this /*&& + this.effectiveLang === this.lang*/) { + this.model = deepcopy(this.text.model); + this._checkLang(); + } + } + + _rendered(e) { + console.log('rendered', e.composedPath()[0], e.target, e.detail, 'lang = ' + this.lang, 'effectiveLang = ' + this.effectiveLang, 'e.target.lang = ' + e.target.lang); + this._checkLang(); + } + + _checkLang() { + var i18nFormats = this.root.querySelectorAll('i18n-format'); + var allLangUpdated = (this.lang === this.effectiveLang); + Array.prototype.forEach.call(i18nFormats, function (el) { + if (el.lang !== this.lang) { + allLangUpdated = false; + } + else { + el.render(); + } + }.bind(this)); + if (allLangUpdated) { + console.log(this.is + ' local-dom-ready'); + this.fire('local-dom-ready'); + } + } + } + customElements.define(AdvancedBindingElement.is, AdvancedBindingElement); + } + break; +case 'base-element': + { + class AdvancedBindingElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + {{tr(status,text.statusMessages)}} + + {{or(value,text.defaultValue)}} + + + {{tr(status,text.statusMessageFormats)}} + {{parameter}} + {{text.annotated-format.2}} + + + + + {{tr('key',text.nodefault)}} + {{text.span_5.0}}{{text.defaultValue}}{{text.defaultValue}} + + + +`); + } + + static get is() { return 'advanced-binding-element' } + static get properties () { + return { + status: { + type: String, + value: 'ok' + }, + value: { + type: String + }, + parameter: { + type: String + } + } + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + this.addEventListener('rendered', this._rendered); + super.ready(); + } + + connectedCallback() { + //console.log('advanced-binding-element: connected'); + super.connectedCallback(); + } + + disconnectedCallback() { + super.disconnectedCallback(); + //console.log('advanced-binding-element: disconnected'); + } + + _langUpdated(e) { + console.log('lang-updated', e.composedPath()[0], e.target, e.detail, 'lang = ' + this.lang, 'effectiveLang = ' + this.effectiveLang); + if (e.composedPath()[0] === this /*&& + this.effectiveLang === this.lang*/) { + this.model = deepcopy(this.text.model); + this._checkLang(); + } + } + + _rendered(e) { + console.log('rendered', e.composedPath()[0], e.target, e.detail, 'lang = ' + this.lang, 'effectiveLang = ' + this.effectiveLang, 'e.target.lang = ' + e.target.lang); + this._checkLang(); + } + + _checkLang() { + var i18nFormats = this.root.querySelectorAll('i18n-format'); + var allLangUpdated = (this.lang === this.effectiveLang); + Array.prototype.forEach.call(i18nFormats, function (el) { + if (el.lang !== this.lang) { + allLangUpdated = false; + } + else { + el.render(); + } + }.bind(this)); + if (allLangUpdated) { + this.fire('local-dom-ready'); + } + } + } + customElements.define(AdvancedBindingElement.is, AdvancedBindingElement); + } + break; +case 'thin': + { + Define = class AdvancedBindingElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + static get properties () { + return { + status: { + type: String, + value: 'ok' + }, + value: { + type: String + }, + parameter: { + type: String + } + } + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + this.addEventListener('rendered', this._rendered); + super.ready(); + } + + connectedCallback() { + //console.log('advanced-binding-element: connected'); + super.connectedCallback(); + } + + disconnectedCallback() { + super.disconnectedCallback(); + //console.log('advanced-binding-element: disconnected'); + } + + _langUpdated(e) { + console.log('lang-updated', e.composedPath()[0], e.target, e.detail, 'lang = ' + this.lang, 'effectiveLang = ' + this.effectiveLang); + if (e.composedPath()[0] === this /*&& + this.effectiveLang === this.lang*/) { + this.model = deepcopy(this.text.model); + this._checkLang(); + } + } + + _rendered(e) { + console.log('rendered', e.composedPath()[0], e.target, e.detail, 'lang = ' + this.lang, 'effectiveLang = ' + this.effectiveLang, 'e.target.lang = ' + e.target.lang); + this._checkLang(); + } + + _checkLang() { + var i18nFormats = this.root.querySelectorAll('i18n-format'); + var allLangUpdated = (this.lang === this.effectiveLang); + Array.prototype.forEach.call(i18nFormats, function (el) { + if (el.lang !== this.lang) { + allLangUpdated = false; + } + else { + el.render(); + } + }.bind(this)); + if (allLangUpdated) { + this.fire('local-dom-ready'); + } + } + } + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + {{tr(status,text.statusMessages)}} + + {{or(value,text.defaultValue)}} + + + {{tr(status,text.statusMessageFormats)}} + {{parameter}} + {{text.annotated-format.2}} + + + + + {{tr('key',text.nodefault)}} + {{text.span_5.0}}{{text.defaultValue}}{{text.defaultValue}} + + + +`), + + is: 'advanced-binding-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + properties: { + status: { + type: String, + value: 'ok' + }, + value: { + type: String + }, + parameter: { + type: String + } + }, + + observers: [ + ], + + listeners: { + 'lang-updated': '_langUpdated', + 'rendered': '_rendered' + }, + + ready: function () { + //this.observeHtmlLang = false; + }, + + attached: function () { + //console.log('advanced-binding-element: attached'); + }, + + detached: function () { + //console.log('advanced-binding-element: detached'); + }, + + _langUpdated: function (e) { + console.log('lang-updated', e.composedPath()[0], e.target, e.detail, 'lang = ' + this.lang, 'effectiveLang = ' + this.effectiveLang); + if (dom(e).rootTarget === this) { + this.model = deepcopy(this.text.model); + this._checkLang(); + } + }, + + _rendered: function (e) { + console.log('rendered', e.composedPath()[0], e.target, e.detail, 'lang = ' + this.lang, 'effectiveLang = ' + this.effectiveLang, 'e.target.lang = ' + e.target.lang); + this._checkLang(); + }, + + _checkLang: function () { + var i18nFormats = this.root.querySelectorAll('i18n-format'); + var allLangUpdated = (this.lang === this.effectiveLang); + Array.prototype.forEach.call(i18nFormats, function (el) { + if (el.lang !== this.lang) { + allLangUpdated = false; + } + else { + el.render(); + } + }.bind(this)); + if (allLangUpdated) { + this.fire('local-dom-ready'); + } + } + }); + } + break; +} diff --git a/test/preprocess3/edge-case/advanced-binding-element.json b/test/preprocess3/edge-case/advanced-binding-element.json new file mode 100644 index 00000000..d9510d4c --- /dev/null +++ b/test/preprocess3/edge-case/advanced-binding-element.json @@ -0,0 +1,36 @@ +{ + "meta": {}, + "model": { + "aria-attributes": { + "title": "tooltip text", + "aria-label": "aria label text", + "aria-valuetext": "aria value text" + } + }, + "annotated-format": [ + "{{tr(status,text.statusMessageFormats)}}", + "{{parameter}}", + "string parameter" + ], + "span_5": [ + "{1} {2}", + "{{text.defaultValue}}", + "{{text.defaultValue}}" + ], + "statusMessages": { + "ok": "healthy status", + "busy": "busy status", + "error": "error status", + "default": "unknown status" + }, + "defaultValue": "default value", + "statusMessageFormats": { + "ok": "healthy status", + "busy": "busy status with {2}", + "error": "error status with {1} and {2}", + "default": "unknown status" + }, + "nodefault": { + "ok": "ok status" + } +} \ No newline at end of file diff --git a/test/preprocess3/edge-case/complex-compound-binding-element.js b/test/preprocess3/edge-case/complex-compound-binding-element.js new file mode 100644 index 00000000..b5372269 --- /dev/null +++ b/test/preprocess3/edge-case/complex-compound-binding-element.js @@ -0,0 +1,582 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class ComplexCompoundBindingElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +
{{text.item-update2:text.0}}{{text.updated}}{{text.item-update2:text_2}} + {{text.item-update2:b_4}} + {{text.item-update2:text_6}}
+
{{text.item-update:text.0}}{{text.updated}}{{text.item-update:text_2}} + {{text.item-update:b_4}} + {{text.item-update:text_6}} + + +
+
{{text.item-update3:text.0}}{{text.updated}}{{text.item-update3:text_2}} + {{text.item-update3:b_4}} + {{text.item-update3:text_6}}
+
{{text.item-update4:text.0}}{{text.updated}}{{text.item-update4:text_2}} + {{text.item-update4:b_4}} + {{text.item-update4:text_6}}
+

{{text.paragraph:text}}{{text.paragraph:text_2}}{{text.paragraph:code_3}}{{text.paragraph:text_4}}

+

{{text.paragraph2:text}}{{text.paragraph2:text_2}}{{text.paragraph2:b_3}}{{text.paragraph2:text_4}}{{text.paragraph2:code_5}}{{text.paragraph2:text_6}} + + +

+ + +`); + } + + static get is() { return 'complex-compound-binding-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated(e) { + console.log('complex-compound-binding-element: lang-updated lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + window.setTimeout(function () { + Array.prototype.forEach.call(this.root.querySelectorAll('i18n-format'), function (node) { + if (!node.elements) { + console.log('elements are missing', node); + node.ready(); + } + node.render(); + }); + console.log(this.is + ' local-dom-ready '); + this.fire('local-dom-ready'); + }.bind(this), 1); + } + } + customElements.define(ComplexCompoundBindingElement.is, ComplexCompoundBindingElement); + } + break; +case 'base-element': + { + class ComplexCompoundBindingElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +
{{text.item-update2:text.0}}{{text.updated}}{{text.item-update2:text_2}} + {{text.item-update2:b_4}} + {{text.item-update2:text_6}}
+
{{text.item-update:text.0}}{{text.updated}}{{text.item-update:text_2}} + {{text.item-update:b_4}} + {{text.item-update:text_6}} + + +
+
{{text.item-update3:text.0}}{{text.updated}}{{text.item-update3:text_2}} + {{text.item-update3:b_4}} + {{text.item-update3:text_6}}
+
{{text.item-update4:text.0}}{{text.updated}}{{text.item-update4:text_2}} + {{text.item-update4:b_4}} + {{text.item-update4:text_6}}
+

{{text.paragraph:text}}{{text.paragraph:text_2}}{{text.paragraph:code_3}}{{text.paragraph:text_4}}

+

{{text.paragraph2:text}}{{text.paragraph2:text_2}}{{text.paragraph2:b_3}}{{text.paragraph2:text_4}}{{text.paragraph2:code_5}}{{text.paragraph2:text_6}} + + +

+ + +`); + } + + static get is() { return 'complex-compound-binding-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated(e) { + console.log('complex-compound-binding-element: lang-updated lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + window.setTimeout(function () { + Array.prototype.forEach.call(this.root.querySelectorAll('i18n-format'), function (node) { + if (!node.elements) { + console.log('elements are missing', node); + node.ready(); + } + node.render(); + }); + console.log(this.is + ' local-dom-ready '); + this.fire('local-dom-ready'); + }.bind(this), 1); + } + } + customElements.define(ComplexCompoundBindingElement.is, ComplexCompoundBindingElement); + } + break; +case 'thin': + { + Define = class ComplexCompoundBindingElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated(e) { + console.log('complex-compound-binding-element: lang-updated lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + window.setTimeout(function () { + Array.prototype.forEach.call(this.root.querySelectorAll('i18n-format'), function (node) { + if (!node.elements) { + console.log('elements are missing', node); + node.ready(); + } + node.render(); + }); + console.log(this.is + ' local-dom-ready '); + this.fire('local-dom-ready'); + }.bind(this), 1); + } + }; + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +
{{text.item-update2:text.0}}{{text.updated}}{{text.item-update2:text_2}} + {{text.item-update2:b_4}} + {{text.item-update2:text_6}}
+
{{text.item-update:text.0}}{{text.updated}}{{text.item-update:text_2}} + {{text.item-update:b_4}} + {{text.item-update:text_6}} + + +
+
{{text.item-update3:text.0}}{{text.updated}}{{text.item-update3:text_2}} + {{text.item-update3:b_4}} + {{text.item-update3:text_6}}
+
{{text.item-update4:text.0}}{{text.updated}}{{text.item-update4:text_2}} + {{text.item-update4:b_4}} + {{text.item-update4:text_6}}
+

{{text.paragraph:text}}{{text.paragraph:text_2}}{{text.paragraph:code_3}}{{text.paragraph:text_4}}

+

{{text.paragraph2:text}}{{text.paragraph2:text_2}}{{text.paragraph2:b_3}}{{text.paragraph2:text_4}}{{text.paragraph2:code_5}}{{text.paragraph2:text_6}} + + +

+ + +`), + + is: 'complex-compound-binding-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + listeners: { + 'lang-updated': '_langUpdated' + }, + + _langUpdated: function (e) { + console.log('complex-compound-binding-element: lang-updated lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + window.setTimeout(function () { + Array.prototype.forEach.call(this.root.querySelectorAll('i18n-format'), function (node) { + if (!node.elements) { + console.log('elements are missing', node); + node.ready(); + } + node.render(); + }); + console.log(this.is + ' local-dom-ready '); + this.fire('local-dom-ready'); + }.bind(this), 1); + } + }); + } + break; +} diff --git a/test/preprocess3/edge-case/complex-compound-binding-element.json b/test/preprocess3/edge-case/complex-compound-binding-element.json new file mode 100644 index 00000000..7951181c --- /dev/null +++ b/test/preprocess3/edge-case/complex-compound-binding-element.json @@ -0,0 +1,69 @@ +{ + "meta": {}, + "model": {}, + "item-update2:text": [ + "updated: {1}, by: ", + "{{text.updated}}" + ], + "item-update2:text_2": " xxx ", + "item-update2:dom-if_3:template:span:b": "IF CONTENT", + "item-update2:b_4": "abc", + "item-update2:dom-if_5:template:text": "IF CONTENT 2", + "item-update2:text_6": " hello ", + "item-update:text": [ + "updated: {1}, by: ", + "{{text.updated}}" + ], + "item-update:text_2": " xxx ", + "item-update:dom-if_3:template:b": "IF CONTENT", + "item-update:b_4": "abc", + "item-update:dom-if_5:template:text": "IF CONTENT 2", + "item-update:text_6": " hello ", + "item-update3:text": [ + "updated: {1}, by: ", + "{{text.updated}}" + ], + "item-update3:text_2": " xxx ", + "item-update3:dom-if_3:template:b": "IF", + "item-update3:dom-if_3:template:b_1": "CONTENT", + "item-update3:b_4": "abc", + "item-update3:dom-if_5:template:text": "IF CONTENT 2", + "item-update3:text_6": " hello ", + "item-update4:text": [ + "updated: {1}, by: ", + "{{text.updated}}" + ], + "item-update4:dom-repeat_1:template:text": [ + " {1} = {2} ", + "{{item.name}}", + "{{text.updated}}" + ], + "item-update4:text_2": " xxx ", + "item-update4:dom-if_3:template:b": "IF CONTENT", + "item-update4:b_4": "abc", + "item-update4:dom-if_5:template:text": "IF CONTENT 2", + "item-update4:text_6": " hello ", + "paragraph:text": "A paragraph with ", + "paragraph:text_2": " is converted to ", + "paragraph:code_3": "", + "paragraph:text_4": ". ", + "paragraph2:text": "A paragraph with deep ", + "paragraph2:text_2": " is ", + "paragraph2:b_3": "not", + "paragraph2:text_4": " converted to ", + "paragraph2:code_5": "", + "paragraph2:text_6": ". ", + "authors": [ + { + "name": "Joe" + }, + { + "name": "Alice" + } + ], + "updated": "Jan 1st, 2016", + "parameters": [ + "parameter 1", + "parameter 2" + ] +} \ No newline at end of file diff --git a/test/preprocess3/edge-case/empty-element.js b/test/preprocess3/edge-case/empty-element.js new file mode 100644 index 00000000..06fd3ee5 --- /dev/null +++ b/test/preprocess3/edge-case/empty-element.js @@ -0,0 +1,106 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class EmptyElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + + +`); + } + + static get is() { return 'empty-element' } + } + customElements.define(EmptyElement.is, EmptyElement); + } + break; +case 'base-element': + { + class EmptyElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + + +`); + } + + static get is() { return 'empty-element' } + } + customElements.define(EmptyElement.is, EmptyElement); + } + break; +case 'thin': + { + Define = class EmptyElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + } + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + + +`), + + is: 'empty-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ] + }); + } + break; +} diff --git a/test/preprocess3/edge-case/empty-element.json b/test/preprocess3/edge-case/empty-element.json new file mode 100644 index 00000000..ce3f5d10 --- /dev/null +++ b/test/preprocess3/edge-case/empty-element.json @@ -0,0 +1,4 @@ +{ + "meta": {}, + "model": {} +} \ No newline at end of file diff --git a/test/preprocess3/edge-case/locales/advanced-binding-element.fr.json b/test/preprocess3/edge-case/locales/advanced-binding-element.fr.json new file mode 100755 index 00000000..54e9a4c1 --- /dev/null +++ b/test/preprocess3/edge-case/locales/advanced-binding-element.fr.json @@ -0,0 +1,38 @@ +{ + "meta": { + "todo": [] + }, + "model": { + "aria-attributes": { + "title": "fr tooltip text", + "aria-label": "fr aria label text", + "aria-valuetext": "fr aria value text" + } + }, + "annotated-format": [ + "{{tr(status,text.statusMessageFormats)}}", + "{{parameter}}", + "fr string parameter" + ], + "span_5": [ + "fr {1} {2}", + "{{text.defaultValue}}", + "{{text.defaultValue}}" + ], + "statusMessages": { + "ok": "fr healthy status", + "busy": "fr busy status", + "error": "fr error status", + "default": "fr unknown status" + }, + "defaultValue": "fr default value", + "statusMessageFormats": { + "ok": "fr healthy status", + "busy": "fr busy status with {2}", + "error": "fr error status with {1} and {2}", + "default": "fr unknown status" + }, + "nodefault": { + "ok": "fr ok status" + } +} \ No newline at end of file diff --git a/test/preprocess3/edge-case/locales/complex-compound-binding-element.fr.json b/test/preprocess3/edge-case/locales/complex-compound-binding-element.fr.json new file mode 100755 index 00000000..7f19263f --- /dev/null +++ b/test/preprocess3/edge-case/locales/complex-compound-binding-element.fr.json @@ -0,0 +1,71 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "item-update2:text": [ + "fr updated: {1}, by: ", + "{{text.updated}}" + ], + "item-update2:text_2": " fr xxx ", + "item-update2:dom-if_3:template:span:b": "fr IF CONTENT", + "item-update2:b_4": "fr abc", + "item-update2:dom-if_5:template:text": "fr IF CONTENT 2", + "item-update2:text_6": " fr hello ", + "item-update:text": [ + "fr updated: {1}, by: ", + "{{text.updated}}" + ], + "item-update:text_2": " fr xxx ", + "item-update:dom-if_3:template:b": "fr IF CONTENT", + "item-update:b_4": "fr abc", + "item-update:dom-if_5:template:text": "fr IF CONTENT 2", + "item-update:text_6": " fr hello ", + "item-update3:text": [ + "fr updated: {1}, by: ", + "{{text.updated}}" + ], + "item-update3:text_2": " fr xxx ", + "item-update3:dom-if_3:template:b": "fr IF", + "item-update3:dom-if_3:template:b_1": "fr CONTENT", + "item-update3:b_4": "fr abc", + "item-update3:dom-if_5:template:text": "fr IF CONTENT 2", + "item-update3:text_6": " fr hello ", + "item-update4:text": [ + "fr updated: {1}, by: ", + "{{text.updated}}" + ], + "item-update4:dom-repeat_1:template:text": [ + " fr {1} = {2} ", + "{{item.name}}", + "{{text.updated}}" + ], + "item-update4:text_2": " fr xxx ", + "item-update4:dom-if_3:template:b": "fr IF CONTENT", + "item-update4:b_4": "fr abc", + "item-update4:dom-if_5:template:text": "fr IF CONTENT 2", + "item-update4:text_6": " fr hello ", + "paragraph:text": "fr A paragraph with ", + "paragraph:text_2": " fr is converted to ", + "paragraph:code_3": "fr ", + "paragraph:text_4": "fr . ", + "paragraph2:text": "fr A paragraph with deep ", + "paragraph2:text_2": " fr is ", + "paragraph2:b_3": "fr not", + "paragraph2:text_4": " fr converted to ", + "paragraph2:code_5": "fr ", + "paragraph2:text_6": "fr . ", + "authors": [ + { + "name": "fr Joe" + }, + { + "name": "fr Alice" + } + ], + "updated": "fr Jan 1st, 2016", + "parameters": [ + "fr parameter 1", + "fr parameter 2" + ] +} \ No newline at end of file diff --git a/test/preprocess3/edge-case/locales/empty-element.fr.json b/test/preprocess3/edge-case/locales/empty-element.fr.json new file mode 100755 index 00000000..3867b299 --- /dev/null +++ b/test/preprocess3/edge-case/locales/empty-element.fr.json @@ -0,0 +1,6 @@ +{ + "meta": { + "todo": [] + }, + "model": {} +} \ No newline at end of file diff --git a/test/preprocess3/edge-case/no-template-element.js b/test/preprocess3/edge-case/no-template-element.js new file mode 100644 index 00000000..775a9f2a --- /dev/null +++ b/test/preprocess3/edge-case/no-template-element.js @@ -0,0 +1,58 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +switch (syntax) { +default: +case 'mixin': + { + class NoTemplateElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get is() { return 'no-template-element' } + } + customElements.define(NoTemplateElement.is, NoTemplateElement); + } + break; +case 'base-element': + { + class NoTemplateElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get is() { return 'no-template-element' } + } + customElements.define(NoTemplateElement.is, NoTemplateElement); + } + break; +case 'thin': + { + Define = class NoTemplateElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + } + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + is: 'no-template-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ] + }); + } + break; +} diff --git a/test/preprocess3/fake-server.js b/test/preprocess3/fake-server.js new file mode 100644 index 00000000..9e789947 --- /dev/null +++ b/test/preprocess3/fake-server.js @@ -0,0 +1,45 @@ +"use strict"; +var fakeServerContents = +{ + "/commented-simple-text-element/commented-simple-text-element.json": "{\n \"meta\": {},\n \"model\": {},\n \"text\": \" outermost text at the beginning \",\n \"h1_3\": \"outermost header 1\",\n \"text_4\": \" outermost text in the middle \",\n \"span_5\": \"simple text without id\",\n \"span_6\": \"simple text without id 2\",\n \"label-1\": \"simple text with id\",\n \"label-2\": \"simple text with id 2\",\n \"div_9:span\": \"simple text within div\",\n \"div_9:span_1\": \"simple text within div 2\",\n \"div_9:div_2:div\": \"great grandchild text within div\",\n \"div_10:text\": \" simple text as the first element in div \",\n \"div_10:span_1\": \"simple text within div\",\n \"div_10:text_2\": \" simple text in the middle of div \",\n \"div_10:span_3\": \"simple text within div 2\",\n \"div_10:div_4:div\": \"great grandchild text within div\",\n \"div_10:text_5\": \" simple text at the last element in div \",\n \"toplevel-div:span\": \"simple text within div\",\n \"toplevel-div:span_1\": \"simple text within div 2\",\n \"third-level-div\": \"great grandchild text within div\",\n \"second-level-div:div_1\": \"great grandchild text within div without id\",\n \"div_12:ul:li\": \"line item without id 1\",\n \"div_12:ul:li_1\": \"line item without id 2\",\n \"div_12:ul:li_2\": \"line item without id 3\",\n \"line-items:li\": \"line item with id 1\",\n \"line-items:li_1\": \"line item with id 2\",\n \"line-items:li_2\": \"line item with id 3\",\n \"p_13\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"parameters\",\n \"\"\n ],\n \"paragraph\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"id\",\n \"\"\n ],\n \"text_15\": \" outermost text at the end \"\n}", + "/commented-simple-text-element/locales/commented-simple-text-element.fr.json": "{\n \"model\": {},\n \"text\": \" fr outermost text at the beginning \",\n \"h1_3\": \"fr outermost header 1\",\n \"text_4\": \" fr outermost text in the middle \",\n \"span_5\": \"fr simple text without id\",\n \"span_6\": \"fr simple text without id 2\",\n \"label-1\": \"fr simple text with id\",\n \"label-2\": \"fr simple text with id 2\",\n \"div_9:span\": \"fr simple text within div\",\n \"div_9:span_1\": \"fr simple text within div 2\",\n \"div_9:div_2:div\": \"fr great grandchild text within div\",\n \"div_10:text\": \" fr simple text as the first element in div \",\n \"div_10:span_1\": \"fr simple text within div\",\n \"div_10:text_2\": \" fr simple text in the middle of div \",\n \"div_10:span_3\": \"fr simple text within div 2\",\n \"div_10:div_4:div\": \"fr great grandchild text within div\",\n \"div_10:text_5\": \" fr simple text at the last element in div \",\n \"toplevel-div:span\": \"fr simple text within div\",\n \"toplevel-div:span_1\": \"fr simple text within div 2\",\n \"third-level-div\": \"fr great grandchild text within div\",\n \"second-level-div:div_1\": \"fr great grandchild text within div without id\",\n \"div_12:ul:li\": \"fr line item without id 1\",\n \"div_12:ul:li_1\": \"fr line item without id 2\",\n \"div_12:ul:li_2\": \"fr line item without id 3\",\n \"line-items:li\": \"fr line item with id 1\",\n \"line-items:li_1\": \"fr line item with id 2\",\n \"line-items:li_2\": \"fr line item with id 3\",\n \"p_13\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"fr parameters\",\n \"fr \"\n ],\n \"paragraph\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"fr id\",\n \"fr \"\n ],\n \"text_15\": \" fr outermost text at the end \"\n}\n", + "/compound-binding-dom-bind.json": "{\n \"meta\": {},\n \"model\": {},\n \"text\": [\n \" outermost text at the beginning with compound {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"h1_3\": [\n \"outermost header 1 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"text_4\": [\n \" outermost text in the middle with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"span_5\": [\n \"simple text without id with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"span_6\": [\n \"simple text without id 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"label-1\": [\n \"simple text with id and {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"label-2\": [\n \"simple text with id and {1} and {2} variables 2\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_9:span\": [\n \"simple text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_9:span_1\": [\n \"simple text within div with {1} and {2} variables 2\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_9:div_2:div\": [\n \"great grandchild text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:text\": [\n \" simple text as the first element in div with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:span_1\": [\n \"simple text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:text_2\": [\n \" simple text in the middle of div with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:span_3\": [\n \"simple text within div with {1} and {2} variables 2\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:div_4:div\": [\n \"great grandchild text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:text_5\": [\n \" simple text at the last element in div with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"toplevel-div:span\": [\n \"simple text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"toplevel-div:span_1\": [\n \"simple text within div 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"third-level-div\": [\n \"great grandchild text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"second-level-div:div_1\": [\n \"great grandchild text within div without id with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_12:ul:li\": [\n \"line item without id 1 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_12:ul:li_1\": [\n \"line item without id 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_12:ul:li_2\": [\n \"line item without id 3 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"line-items:li\": [\n \"line item with id 1 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"line-items:li_1\": [\n \"line item with id 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"line-items:li_2\": [\n \"line item with id 3 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"p_13\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"paragraph\": [\n \"A paragraph with {1}, {2}, and {3} is converted to {4}.\",\n \"id\",\n \"{{param1}}\",\n \"{{param2}}\",\n \"\"\n ],\n \"text_15\": [\n \" outermost text at the end with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ]\n}", + "/compound-binding-element/compound-binding-element.json": "{\n \"meta\": {},\n \"model\": {},\n \"text\": [\n \" outermost text at the beginning with compound {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"h1_3\": [\n \"outermost header 1 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"text_4\": [\n \" outermost text in the middle with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"span_5\": [\n \"simple text without id with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"span_6\": [\n \"simple text without id 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"label-1\": [\n \"simple text with id and {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"label-2\": [\n \"simple text with id and {1} and {2} variables 2\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_9:span\": [\n \"simple text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_9:span_1\": [\n \"simple text within div with {1} and {2} variables 2\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_9:div_2:div\": [\n \"great grandchild text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:text\": [\n \" simple text as the first element in div with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:span_1\": [\n \"simple text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:text_2\": [\n \" simple text in the middle of div with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:span_3\": [\n \"simple text within div with {1} and {2} variables 2\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:div_4:div\": [\n \"great grandchild text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:text_5\": [\n \" simple text at the last element in div with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"toplevel-div:span\": [\n \"simple text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"toplevel-div:span_1\": [\n \"simple text within div 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"third-level-div\": [\n \"great grandchild text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"second-level-div:div_1\": [\n \"great grandchild text within div without id with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_12:ul:li\": [\n \"line item without id 1 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_12:ul:li_1\": [\n \"line item without id 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_12:ul:li_2\": [\n \"line item without id 3 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"line-items:li\": [\n \"line item with id 1 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"line-items:li_1\": [\n \"line item with id 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"line-items:li_2\": [\n \"line item with id 3 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"p_13\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"paragraph\": [\n \"A paragraph with {1}, {2}, and {3} is converted to {4}.\",\n \"id\",\n \"{{param1}}\",\n \"{{param2}}\",\n \"\"\n ],\n \"text_15\": [\n \" outermost text at the end with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ]\n}", + "/compound-binding-element/locales/compound-binding-element.fr.json": "{\n \"model\": {},\n \"text\": [\n \" fr outermost text at the beginning with compound {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"h1_3\": [\n \"fr outermost header 1 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"text_4\": [\n \" fr outermost text in the middle with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"span_5\": [\n \"fr simple text without id with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"span_6\": [\n \"fr simple text without id 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"label-1\": [\n \"fr simple text with id and {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"label-2\": [\n \"fr simple text with id and {1} and {2} variables 2\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_9:span\": [\n \"fr simple text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_9:span_1\": [\n \"fr simple text within div with {1} and {2} variables 2\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_9:div_2:div\": [\n \"fr great grandchild text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:text\": [\n \" fr simple text as the first element in div with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:span_1\": [\n \"fr simple text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:text_2\": [\n \" fr simple text in the middle of div with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:span_3\": [\n \"fr simple text within div with {1} and {2} variables 2\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:div_4:div\": [\n \"fr great grandchild text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:text_5\": [\n \" fr simple text at the last element in div with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"toplevel-div:span\": [\n \"fr simple text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"toplevel-div:span_1\": [\n \"fr simple text within div 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"third-level-div\": [\n \"fr great grandchild text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"second-level-div:div_1\": [\n \"fr great grandchild text within div without id with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_12:ul:li\": [\n \"fr line item without id 1 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_12:ul:li_1\": [\n \"fr line item without id 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_12:ul:li_2\": [\n \"fr line item without id 3 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"line-items:li\": [\n \"fr line item with id 1 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"line-items:li_1\": [\n \"fr line item with id 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"line-items:li_2\": [\n \"fr line item with id 3 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"p_13\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"paragraph\": [\n \"fr A paragraph with {1}, {2}, and {3} is converted to {4}.\",\n \"fr id\",\n \"{{param1}}\",\n \"{{param2}}\",\n \"fr \"\n ],\n \"text_15\": [\n \" fr outermost text at the end with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ]\n}\n", + "/edge-case-dom-bind.json": "{\n \"meta\": {},\n \"model\": {},\n \"text\": [\n \" name = {1} \",\n \"{{text.name}}\"\n ],\n \"i18n-number_1\": \"1\",\n \"i18n-format_2\": [\n \"{{text.format}}\",\n \"1\"\n ],\n \"i18n-format_3\": [\n \"format\",\n \"\"\n ],\n \"p_8\": [\n \"hello {1}{2} {3} world\",\n \"
\",\n \"\",\n \"\"\n ],\n \"p_9\": [\n \"hello{1}world\",\n \"
\"\n ],\n \"text_10\": \" hello \",\n \"text_14\": \" world \"\n}", + "/edge-case/advanced-binding-element.json": "{\n \"meta\": {},\n \"model\": {\n \"aria-attributes\": {\n \"title\": \"tooltip text\",\n \"aria-label\": \"aria label text\",\n \"aria-valuetext\": \"aria value text\"\n }\n },\n \"annotated-format\": [\n \"{{tr(status,text.statusMessageFormats)}}\",\n \"{{parameter}}\",\n \"string parameter\"\n ],\n \"span_5\": [\n \"{1} {2}\",\n \"{{text.defaultValue}}\",\n \"{{text.defaultValue}}\"\n ],\n \"statusMessages\": {\n \"ok\": \"healthy status\",\n \"busy\": \"busy status\",\n \"error\": \"error status\",\n \"default\": \"unknown status\"\n },\n \"defaultValue\": \"default value\",\n \"statusMessageFormats\": {\n \"ok\": \"healthy status\",\n \"busy\": \"busy status with {2}\",\n \"error\": \"error status with {1} and {2}\",\n \"default\": \"unknown status\"\n },\n \"nodefault\": {\n \"ok\": \"ok status\"\n }\n}", + "/edge-case/complex-compound-binding-element.json": "{\n \"meta\": {},\n \"model\": {},\n \"item-update2:text\": [\n \"updated: {1}, by: \",\n \"{{text.updated}}\"\n ],\n \"item-update2:text_2\": \" xxx \",\n \"item-update2:dom-if_3:template:span:b\": \"IF CONTENT\",\n \"item-update2:b_4\": \"abc\",\n \"item-update2:dom-if_5:template:text\": \"IF CONTENT 2\",\n \"item-update2:text_6\": \" hello \",\n \"item-update:text\": [\n \"updated: {1}, by: \",\n \"{{text.updated}}\"\n ],\n \"item-update:text_2\": \" xxx \",\n \"item-update:dom-if_3:template:b\": \"IF CONTENT\",\n \"item-update:b_4\": \"abc\",\n \"item-update:dom-if_5:template:text\": \"IF CONTENT 2\",\n \"item-update:text_6\": \" hello \",\n \"item-update3:text\": [\n \"updated: {1}, by: \",\n \"{{text.updated}}\"\n ],\n \"item-update3:text_2\": \" xxx \",\n \"item-update3:dom-if_3:template:b\": \"IF\",\n \"item-update3:dom-if_3:template:b_1\": \"CONTENT\",\n \"item-update3:b_4\": \"abc\",\n \"item-update3:dom-if_5:template:text\": \"IF CONTENT 2\",\n \"item-update3:text_6\": \" hello \",\n \"item-update4:text\": [\n \"updated: {1}, by: \",\n \"{{text.updated}}\"\n ],\n \"item-update4:dom-repeat_1:template:text\": [\n \" {1} = {2} \",\n \"{{item.name}}\",\n \"{{text.updated}}\"\n ],\n \"item-update4:text_2\": \" xxx \",\n \"item-update4:dom-if_3:template:b\": \"IF CONTENT\",\n \"item-update4:b_4\": \"abc\",\n \"item-update4:dom-if_5:template:text\": \"IF CONTENT 2\",\n \"item-update4:text_6\": \" hello \",\n \"paragraph:text\": \"A paragraph with \",\n \"paragraph:text_2\": \" is converted to \",\n \"paragraph:code_3\": \"\",\n \"paragraph:text_4\": \". \",\n \"paragraph2:text\": \"A paragraph with deep \",\n \"paragraph2:text_2\": \" is \",\n \"paragraph2:b_3\": \"not\",\n \"paragraph2:text_4\": \" converted to \",\n \"paragraph2:code_5\": \"\",\n \"paragraph2:text_6\": \". \",\n \"authors\": [\n {\n \"name\": \"Joe\"\n },\n {\n \"name\": \"Alice\"\n }\n ],\n \"updated\": \"Jan 1st, 2016\",\n \"parameters\": [\n \"parameter 1\",\n \"parameter 2\"\n ]\n}", + "/edge-case/empty-element.json": "{}", + "/edge-case/locales/advanced-binding-element.fr.json": "{\n \"meta\": {},\n \"model\": {\n \"aria-attributes\": {\n \"title\": \"fr tooltip text\",\n \"aria-label\": \"fr aria label text\",\n \"aria-valuetext\": \"fr aria value text\"\n }\n },\n \"annotated-format\": [\n \"{{tr(status,text.statusMessageFormats)}}\",\n \"{{parameter}}\",\n \"fr string parameter\"\n ],\n \"span_5\": [\n \"fr {1} {2}\",\n \"{{text.defaultValue}}\",\n \"{{text.defaultValue}}\"\n ],\n \"statusMessages\": {\n \"ok\": \"fr healthy status\",\n \"busy\": \"fr busy status\",\n \"error\": \"fr error status\",\n \"default\": \"fr unknown status\"\n },\n \"defaultValue\": \"fr default value\",\n \"statusMessageFormats\": {\n \"ok\": \"fr healthy status\",\n \"busy\": \"fr busy status with {2}\",\n \"error\": \"fr error status with {1} and {2}\",\n \"default\": \"fr unknown status\"\n },\n \"nodefault\": {\n \"ok\": \"fr ok status\"\n }\n}", + "/edge-case/locales/complex-compound-binding-element.fr.json": "{\n \"meta\": {},\n \"model\": {},\n \"item-update2:text\": [\n \"fr updated: {1}, by: \",\n \"{{text.updated}}\"\n ],\n \"item-update2:text_2\": \" fr xxx \",\n \"item-update2:dom-if_3:template:span:b\": \"fr IF CONTENT\",\n \"item-update2:b_4\": \"fr abc\",\n \"item-update2:dom-if_5:template:text\": \"fr IF CONTENT 2\",\n \"item-update2:text_6\": \" fr hello \",\n \"item-update:text\": [\n \"fr updated: {1}, by: \",\n \"{{text.updated}}\"\n ],\n \"item-update:text_2\": \" fr xxx \",\n \"item-update:dom-if_3:template:b\": \"fr IF CONTENT\",\n \"item-update:b_4\": \"fr abc\",\n \"item-update:dom-if_5:template:text\": \"fr IF CONTENT 2\",\n \"item-update:text_6\": \" fr hello \",\n \"item-update3:text\": [\n \"fr updated: {1}, by: \",\n \"{{text.updated}}\"\n ],\n \"item-update3:text_2\": \" fr xxx \",\n \"item-update3:dom-if_3:template:b\": \"fr IF\",\n \"item-update3:dom-if_3:template:b_1\": \"fr CONTENT\",\n \"item-update3:b_4\": \"fr abc\",\n \"item-update3:dom-if_5:template:text\": \"fr IF CONTENT 2\",\n \"item-update3:text_6\": \" fr hello \",\n \"item-update4:text\": [\n \"fr updated: {1}, by: \",\n \"{{text.updated}}\"\n ],\n \"item-update4:dom-repeat_1:template:text\": [\n \" fr {1} = {2} \",\n \"{{item.name}}\",\n \"{{text.updated}}\"\n ],\n \"item-update4:text_2\": \" fr xxx \",\n \"item-update4:dom-if_3:template:b\": \"fr IF CONTENT\",\n \"item-update4:b_4\": \"fr abc\",\n \"item-update4:dom-if_5:template:text\": \"fr IF CONTENT 2\",\n \"item-update4:text_6\": \" fr hello \",\n \"paragraph:text\": \"fr A paragraph with \",\n \"paragraph:text_2\": \" fr is converted to \",\n \"paragraph:code_3\": \"fr \",\n \"paragraph:text_4\": \"fr . \",\n \"paragraph2:text\": \"fr A paragraph with deep \",\n \"paragraph2:text_2\": \" fr is \",\n \"paragraph2:b_3\": \"fr not\",\n \"paragraph2:text_4\": \" fr converted to \",\n \"paragraph2:code_5\": \"fr \",\n \"paragraph2:text_6\": \"fr . \",\n \"authors\": [\n {\n \"name\": \"fr Joe\"\n },\n {\n \"name\": \"fr Alice\"\n }\n ],\n \"updated\": \"fr Jan 1st, 2016\",\n \"parameters\": [\n \"fr parameter 1\",\n \"fr parameter 2\"\n ]\n}", + "/edge-case/locales/empty-element.fr.json": "{}", + "/fallback-text-element/fallback-text-element.json": "{\n \"meta\": {},\n \"model\": {},\n \"text\": \" outermost text at the beginning \",\n \"h1_3\": \"outermost header 1\",\n \"text_4\": \" outermost text in the middle \",\n \"span_5\": \"simple text without id\",\n \"span_6\": \"simple text without id 2\",\n \"label-1\": \"simple text with id\",\n \"label-2\": \"simple text with id 2\",\n \"div_9:span\": \"simple text within div\",\n \"div_9:span_1\": \"simple text within div 2\",\n \"div_9:div_2:div\": \"great grandchild text within div\",\n \"div_10:text\": \" simple text as the first element in div \",\n \"div_10:span_1\": \"simple text within div\",\n \"div_10:text_2\": \" simple text in the middle of div \",\n \"div_10:span_3\": \"simple text within div 2\",\n \"div_10:div_4:div\": \"great grandchild text within div\",\n \"div_10:text_5\": \" simple text at the last element in div \",\n \"toplevel-div:span\": \"simple text within div\",\n \"toplevel-div:span_1\": \"simple text within div 2\",\n \"third-level-div\": \"great grandchild text within div\",\n \"second-level-div:div_1\": \"great grandchild text within div without id\",\n \"div_12:ul:li\": \"line item without id 1\",\n \"div_12:ul:li_1\": \"line item without id 2\",\n \"div_12:ul:li_2\": \"line item without id 3\",\n \"line-items:li\": \"line item with id 1\",\n \"line-items:li_1\": \"line item with id 2\",\n \"line-items:li_2\": \"line item with id 3\",\n \"p_13\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"parameters\",\n \"\"\n ],\n \"paragraph\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"id\",\n \"\"\n ],\n \"text_15\": \" outermost text at the end \"\n}", + "/fallback-text-element/locales/fallback-text-element.fr-CA.json": "{\n \"model\": {},\n \"text\": \"fr-CA outermost text at the beginning \",\n \"h1_3\": \"fr-CA outermost header 1\",\n \"text_4\": \"fr-CA outermost text in the middle \",\n \"span_5\": \"fr-CA simple text without id\",\n \"span_6\": \"fr-CA simple text without id 2\",\n \"label-1\": \"fr-CA simple text with id\",\n \"label-2\": \"fr-CA simple text with id 2\",\n \"div_10:span_1\": \"fr-CA simple text within div\",\n \"toplevel-div:span\": \"fr-CA simple text within div\",\n \"toplevel-div:span_1\": \"fr-CA simple text within div 2\",\n \"third-level-div\": \"fr-CA great grandchild text within div\",\n \"second-level-div:div_1\": \"fr-CA great grandchild text within div without id\",\n \"p_13\": [\n \"fr-CA A paragraph with {1} is converted to {2}.\",\n \"fr-CA parameters\",\n \"fr-CA \"\n ],\n \"paragraph\": [\n \"fr-CA A paragraph with {1} is converted to {2}.\",\n \"fr-CA id\",\n \"fr-CA \"\n ],\n \"text_15\": \"fr-CA outermost text at the end \"\n}\n", + "/fallback-text-element/locales/fallback-text-element.fr.json": "{\n \"model\": {},\n \"text\": \"fr outermost text at the beginning \",\n \"h1_3\": \"fr outermost header 1\",\n \"text_4\": \"fr outermost text in the middle \",\n \"span_5\": \"fr simple text without id\",\n \"span_6\": \"fr simple text without id 2\",\n \"label-1\": \"fr simple text with id\",\n \"label-2\": \"fr simple text with id 2\",\n \"toplevel-div:span\": \"fr simple text within div\",\n \"toplevel-div:span_1\": \"fr simple text within div 2\",\n \"third-level-div\": \"fr great grandchild text within div\",\n \"second-level-div:div_1\": \"fr great grandchild text within div without id\",\n \"div_12:ul:li\": \"fr line item without id 1\",\n \"div_12:ul:li_1\": \"fr line item without id 2\",\n \"div_12:ul:li_2\": \"fr line item without id 3\",\n \"line-items:li\": \"fr line item with id 1\",\n \"line-items:li_1\": \"fr line item with id 2\",\n \"line-items:li_2\": \"fr line item with id 3\",\n \"p_13\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"fr parameters\",\n \"fr \"\n ],\n \"paragraph\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"fr id\",\n \"fr \"\n ],\n \"text_15\": \"fr outermost text at the end \"\n}\n", + "/locales/compound-binding-dom-bind.fr.json": "{\n \"model\": {},\n \"text\": [\n \" fr outermost text at the beginning with compound {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"h1_3\": [\n \"fr outermost header 1 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"text_4\": [\n \" fr outermost text in the middle with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"span_5\": [\n \"fr simple text without id with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"span_6\": [\n \"fr simple text without id 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"label-1\": [\n \"fr simple text with id and {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"label-2\": [\n \"fr simple text with id and {1} and {2} variables 2\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_9:span\": [\n \"fr simple text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_9:span_1\": [\n \"fr simple text within div with {1} and {2} variables 2\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_9:div_2:div\": [\n \"fr great grandchild text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:text\": [\n \" fr simple text as the first element in div with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:span_1\": [\n \"fr simple text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:text_2\": [\n \" fr simple text in the middle of div with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:span_3\": [\n \"fr simple text within div with {1} and {2} variables 2\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:div_4:div\": [\n \"fr great grandchild text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_10:text_5\": [\n \" fr simple text at the last element in div with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"toplevel-div:span\": [\n \"fr simple text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"toplevel-div:span_1\": [\n \"fr simple text within div 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"third-level-div\": [\n \"fr great grandchild text within div with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"second-level-div:div_1\": [\n \"fr great grandchild text within div without id with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_12:ul:li\": [\n \"fr line item without id 1 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_12:ul:li_1\": [\n \"fr line item without id 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"div_12:ul:li_2\": [\n \"fr line item without id 3 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"line-items:li\": [\n \"fr line item with id 1 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"line-items:li_1\": [\n \"fr line item with id 2 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"line-items:li_2\": [\n \"fr line item with id 3 with {1} and {2} variables\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"p_13\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"{{param1}}\",\n \"{{param2}}\"\n ],\n \"paragraph\": [\n \"fr A paragraph with {1}, {2}, and {3} is converted to {4}.\",\n \"fr id\",\n \"{{param1}}\",\n \"{{param2}}\",\n \"fr \"\n ],\n \"text_15\": [\n \" fr outermost text at the end with {1} and {2} variables \",\n \"{{param1}}\",\n \"{{param2}}\"\n ]\n}\n", + "/locales/simple-attribute-dom-bind.fr.json": "{\n \"model\": {\n \"standard-input\": {\n \"placeholder\": \"fr standard HTML5 attribute\"\n },\n \"outer-div:input_2\": {\n \"placeholder\": \"fr standard HTML5 attribute without id\"\n },\n \"paper-input-element\": {\n \"label\": \"fr paper-input label\",\n \"error-message\": \"fr paper-input error message\",\n \"placeholder\": \"fr paper-input placeholder\"\n },\n \"outer-div:paper-input_4\": {\n \"label\": \"fr paper-input label without id\",\n \"error-message\": \"fr paper-input error message without id\",\n \"placeholder\": \"fr paper-input placeholder without id\"\n },\n \"pie-chart\": {\n \"options\": {\n \"title\": \"fr Distribution of days in 2001H1\"\n },\n \"cols\": [\n {\n \"label\": \"fr Month\",\n \"type\": \"string\"\n },\n {\n \"label\": \"fr Days\",\n \"type\": \"number\"\n }\n ],\n \"rows\": [\n [\n \"fr Jan\",\n 31\n ],\n [\n \"fr Feb\",\n 28\n ],\n [\n \"fr Mar\",\n 31\n ],\n [\n \"fr Apr\",\n 30\n ],\n [\n \"fr May\",\n 31\n ],\n [\n \"fr Jun\",\n 30\n ]\n ]\n },\n \"column-chart\": {\n \"options\": {\n \"title\": \"fr Inventory\"\n },\n \"data\": [\n [\n \"fr Year\",\n \"fr Things\",\n \"fr Stuff\"\n ],\n [\n \"2004\",\n 1000,\n 400\n ],\n [\n \"2005\",\n 1170,\n 460\n ],\n [\n \"2006\",\n 660,\n 1120\n ],\n [\n \"2007\",\n 1030,\n 540\n ]\n ]\n },\n \"custom-attr\": {\n \"custom-text-attr1\": \"fr custom text attribute 1\",\n \"custom-text-attr2\": \"fr custom text attribute 2\",\n \"custom-text-attr3\": \"fr custom text attribute 3\"\n },\n \"selective-attr\": {\n \"custom-text-attr4\": [\n \"fr {1} custom-text-attr4 attribute with param {2} and param {3} {4}\",\n \"{{text.ordinary-div}}\",\n \"{{text.ordinary-div}}\",\n \"[[text.ordinary-div]]\",\n \"{{text.ordinary-div}}\"\n ],\n \"custom-text-attr5\": [\n \"[[text.ordinary-div]]\",\n \" fr custom-text-attr5 attribute with param \",\n \"{{or('',text.ordinary-div)}}\",\n \" fr and param \",\n \"[[text.ordinary-div]]\"\n ],\n \"i18n-target\": [\n \"fr i18n-target attribute with param {1} and param {2}\",\n \"{{text.ordinary-div}}\",\n \"[[text.ordinary-div]]\"\n ],\n \"i18n-target2\": [\n \"fr i18n-target2 attribute with param \",\n \"{{or('',text.ordinary-div)}}\",\n \" fr and param \",\n \"[[text.ordinary-div]]\"\n ]\n },\n \"selective-attr2\": {\n \"i18n-target\": \"fr i18n-target attribute 2\"\n },\n \"selective-attr3\": {\n \"i18n-target6\": \"fr i18n-target6 attribute 2\"\n },\n \"selective-attr4\": {\n \"i18n-target6\": \"fr i18n-target6 attribute 3\"\n },\n \"json-data-id\": {\n \"attr1\": \"fr this attr1 is extracted\",\n \"i18n-target-attr\": \"fr this attribute is also extracted\"\n },\n \"template_2:json-data_1\": {\n \"attr1\": \"fr this attr1 without id is extracted\",\n \"i18n-target-attr\": \"fr this attribute without id is also extracted\"\n }\n },\n \"ordinary-div\": \"fr text 1\"\n}\n", + "/locales/simple-text-dom-bind.fr.json": "{\n \"model\": {},\n \"text\": \" fr outermost text at the beginning \",\n \"h1_3\": \"fr outermost header 1\",\n \"text_4\": \" fr outermost text in the middle \",\n \"span_5\": \"fr simple text without id\",\n \"span_6\": \"fr simple text without id 2\",\n \"label-1\": \"fr simple text with id\",\n \"label-2\": \"fr simple text with id 2\",\n \"div_9:span\": \"fr simple text within div\",\n \"div_9:span_1\": \"fr simple text within div 2\",\n \"div_9:div_2:div\": \"fr great grandchild text within div\",\n \"div_10:text\": \" fr simple text as the first element in div \",\n \"div_10:span_1\": \"fr simple text within div\",\n \"div_10:text_2\": \" fr simple text in the middle of div \",\n \"div_10:span_3\": \"fr simple text within div 2\",\n \"div_10:div_4:div\": \"fr great grandchild text within div\",\n \"div_10:text_5\": \" fr simple text at the last element in div \",\n \"toplevel-div:span\": \"fr simple text within div\",\n \"toplevel-div:span_1\": \"fr simple text within div 2\",\n \"third-level-div\": \"fr great grandchild text within div\",\n \"second-level-div:div_1\": \"fr great grandchild text within div without id\",\n \"div_12:ul:li\": \"fr line item without id 1\",\n \"div_12:ul:li_1\": \"fr line item without id 2\",\n \"div_12:ul:li_2\": \"fr line item without id 3\",\n \"line-items:li\": \"fr line item with id 1\",\n \"line-items:li_1\": \"fr line item with id 2\",\n \"line-items:li_2\": \"fr line item with id 3\",\n \"p_13\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"fr parameters\",\n \"fr \"\n ],\n \"paragraph\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"fr id\",\n \"fr \"\n ],\n \"text_15\": \" fr outermost text at the end \"\n}\n", + "/multiple-case/item-element.json": "{\n \"meta\": {},\n \"model\": {},\n \"label\": \"A\"\n}", + "/multiple-case/locales/item-element.fr.json": "{\n \"meta\": {},\n \"model\": {},\n \"label\": \"fr A\"\n}", + "/multiple-case/locales/multiple-element.fr.json": "{\n \"meta\": {},\n \"model\": {}\n}", + "/multiple-case/multiple-element.json": "{\n \"meta\": {},\n \"model\": {}\n}", + "/plural-gender-element/locales/plural-gender-element.fr.json": "{\n \"model\": {},\n \"compound-format-text\": [\n {\n \"0\": \"fr You ({3}) gave no gifts.\",\n \"1\": {\n \"male\": \"fr You ({3}) gave him ({4}) {5}.\",\n \"female\": \"fr You ({3}) gave her ({4}) {5}.\",\n \"other\": \"fr You ({3}) gave them ({4}) {5}.\"\n },\n \"one\": {\n \"male\": \"fr You ({3}) gave him ({4}) and one other person {5}.\",\n \"female\": \"fr You ({3}) gave her ({4}) and one other person {5}.\",\n \"other\": \"fr You ({3}) gave them ({4}) and one other person {5}.\"\n },\n \"other\": \"fr You ({3}) gave them ({4}) and {1} other people gifts.\"\n },\n \"{{recipients.length - 1}}\",\n \"{{recipients.0.gender}}\",\n \"{{sender.name}}\",\n \"{{recipients.0.name}}\",\n \"fr a gift\"\n ]\n}\n", + "/plural-gender-element/plural-gender-element.json": "{\n \"meta\": {},\n \"model\": {},\n \"compound-format-text\": [\n {\n \"0\": \"You ({3}) gave no gifts.\",\n \"1\": {\n \"male\": \"You ({3}) gave him ({4}) {5}.\",\n \"female\": \"You ({3}) gave her ({4}) {5}.\",\n \"other\": \"You ({3}) gave them ({4}) {5}.\"\n },\n \"one\": {\n \"male\": \"You ({3}) gave him ({4}) and one other person {5}.\",\n \"female\": \"You ({3}) gave her ({4}) and one other person {5}.\",\n \"other\": \"You ({3}) gave them ({4}) and one other person {5}.\"\n },\n \"other\": \"You ({3}) gave them ({4}) and {1} other people gifts.\"\n },\n \"{{recipients.length - 1}}\",\n \"{{recipients.0.gender}}\",\n \"{{sender.name}}\",\n \"{{recipients.0.name}}\",\n \"a gift\"\n ]\n}", + "/preference/preference-element.json": "{\n \"meta\": {},\n \"model\": {}\n}", + "/simple-attribute-dom-bind.json": "{\n \"meta\": {},\n \"model\": {\n \"standard-input\": {\n \"placeholder\": \"standard HTML5 attribute\"\n },\n \"outer-div:input_2\": {\n \"placeholder\": \"standard HTML5 attribute without id\"\n },\n \"paper-input-element\": {\n \"label\": \"paper-input label\",\n \"error-message\": \"paper-input error message\",\n \"placeholder\": \"paper-input placeholder\"\n },\n \"outer-div:paper-input_4\": {\n \"label\": \"paper-input label without id\",\n \"error-message\": \"paper-input error message without id\",\n \"placeholder\": \"paper-input placeholder without id\"\n },\n \"pie-chart\": {\n \"options\": {\n \"title\": \"Distribution of days in 2001H1\"\n },\n \"cols\": [\n {\n \"label\": \"Month\",\n \"type\": \"string\"\n },\n {\n \"label\": \"Days\",\n \"type\": \"number\"\n }\n ],\n \"rows\": [\n [\n \"Jan\",\n 31\n ],\n [\n \"Feb\",\n 28\n ],\n [\n \"Mar\",\n 31\n ],\n [\n \"Apr\",\n 30\n ],\n [\n \"May\",\n 31\n ],\n [\n \"Jun\",\n 30\n ]\n ]\n },\n \"column-chart\": {\n \"options\": {\n \"title\": \"Inventory\"\n },\n \"data\": [\n [\n \"Year\",\n \"Things\",\n \"Stuff\"\n ],\n [\n \"2004\",\n 1000,\n 400\n ],\n [\n \"2005\",\n 1170,\n 460\n ],\n [\n \"2006\",\n 660,\n 1120\n ],\n [\n \"2007\",\n 1030,\n 540\n ]\n ]\n },\n \"custom-attr\": {\n \"custom-text-attr1\": \"custom text attribute 1\",\n \"custom-text-attr2\": \"custom text attribute 2\",\n \"custom-text-attr3\": \"custom text attribute 3\"\n },\n \"selective-attr\": {\n \"custom-text-attr4\": [\n \"{1} custom-text-attr4 attribute with param {2} and param {3} {4}\",\n \"{{text.ordinary-div}}\",\n \"{{text.ordinary-div}}\",\n \"[[text.ordinary-div]]\",\n \"{{text.ordinary-div}}\"\n ],\n \"custom-text-attr5\": [\n \"[[text.ordinary-div]]\",\n \" custom-text-attr5 attribute with param \",\n \"{{or('',text.ordinary-div)}}\",\n \" and param \",\n \"[[text.ordinary-div]]\"\n ],\n \"i18n-target\": [\n \"i18n-target attribute with param {1} and param {2}\",\n \"{{text.ordinary-div}}\",\n \"[[text.ordinary-div]]\"\n ],\n \"i18n-target2\": [\n \"i18n-target2 attribute with param \",\n \"{{or('',text.ordinary-div)}}\",\n \" and param \",\n \"[[text.ordinary-div]]\"\n ]\n },\n \"selective-attr2\": {\n \"i18n-target\": \"i18n-target attribute 2\"\n },\n \"selective-attr3\": {\n \"i18n-target6\": \"i18n-target6 attribute 2\"\n },\n \"selective-attr4\": {\n \"i18n-target6\": \"i18n-target6 attribute 3\"\n },\n \"json-data-id\": {\n \"attr1\": \"this attr1 is extracted\",\n \"i18n-target-attr\": \"this attribute is also extracted\"\n },\n \"template_2:json-data_1\": {\n \"attr1\": \"this attr1 without id is extracted\",\n \"i18n-target-attr\": \"this attribute without id is also extracted\"\n }\n },\n \"ordinary-div\": \"text 1\"\n}", + "/simple-attribute-element/locales/simple-attribute-element.fr.json": "{\n \"model\": {\n \"standard-input\": {\n \"placeholder\": \"fr standard HTML5 attribute\"\n },\n \"outer-div:input_2\": {\n \"placeholder\": \"fr standard HTML5 attribute without id\"\n },\n \"paper-input-element\": {\n \"label\": \"fr paper-input label\",\n \"error-message\": \"fr paper-input error message\",\n \"placeholder\": \"fr paper-input placeholder\"\n },\n \"outer-div:paper-input_4\": {\n \"label\": \"fr paper-input label without id\",\n \"error-message\": \"fr paper-input error message without id\",\n \"placeholder\": \"fr paper-input placeholder without id\"\n },\n \"pie-chart\": {\n \"options\": {\n \"title\": \"fr Distribution of days in 2001H1\"\n },\n \"cols\": [\n {\n \"label\": \"fr Month\",\n \"type\": \"string\"\n },\n {\n \"label\": \"fr Days\",\n \"type\": \"number\"\n }\n ],\n \"rows\": [\n [\n \"fr Jan\",\n 31\n ],\n [\n \"fr Feb\",\n 28\n ],\n [\n \"fr Mar\",\n 31\n ],\n [\n \"fr Apr\",\n 30\n ],\n [\n \"fr May\",\n 31\n ],\n [\n \"fr Jun\",\n 30\n ]\n ]\n },\n \"column-chart\": {\n \"options\": {\n \"title\": \"fr Inventory\"\n },\n \"data\": [\n [\n \"fr Year\",\n \"fr Things\",\n \"fr Stuff\"\n ],\n [\n \"2004\",\n 1000,\n 400\n ],\n [\n \"2005\",\n 1170,\n 460\n ],\n [\n \"2006\",\n 660,\n 1120\n ],\n [\n \"2007\",\n 1030,\n 540\n ]\n ]\n },\n \"custom-attr\": {\n \"custom-text-attr1\": \"fr custom text attribute 1\",\n \"custom-text-attr2\": \"fr custom text attribute 2\",\n \"custom-text-attr3\": \"fr custom text attribute 3\"\n },\n \"selective-attr\": {\n \"custom-text-attr4\": [\n \"fr {1} custom-text-attr4 attribute with param {2} and param {3} {4}\",\n \"{{text.ordinary-div}}\",\n \"{{text.ordinary-div}}\",\n \"[[text.ordinary-div]]\",\n \"{{text.ordinary-div}}\"\n ],\n \"custom-text-attr5\": [\n \"[[text.ordinary-div]]\",\n \" fr custom-text-attr5 attribute with param \",\n \"{{or('',text.ordinary-div)}}\",\n \" fr and param \",\n \"[[text.ordinary-div]]\"\n ],\n \"i18n-target\": [\n \"fr i18n-target attribute with param {1} and param {2}\",\n \"{{text.ordinary-div}}\",\n \"[[text.ordinary-div]]\"\n ],\n \"i18n-target2\": [\n \"fr i18n-target2 attribute with param \",\n \"{{or('',text.ordinary-div)}}\",\n \" fr and param \",\n \"[[text.ordinary-div]]\"\n ]\n },\n \"selective-attr2\": {\n \"i18n-target\": \"fr i18n-target attribute 2\"\n },\n \"selective-attr3\": {\n \"i18n-target6\": \"fr i18n-target6 attribute 2\"\n },\n \"selective-attr4\": {\n \"i18n-target6\": \"fr i18n-target6 attribute 3\"\n },\n \"json-data-id\": {\n \"attr1\": \"fr this attr1 is extracted\",\n \"i18n-target-attr\": \"fr this attribute is also extracted\"\n },\n \"template_2:json-data_1\": {\n \"attr1\": \"fr this attr1 without id is extracted\",\n \"i18n-target-attr\": \"fr this attribute without id is also extracted\"\n }\n },\n \"ordinary-div\": \"fr text 1\"\n}\n", + "/simple-attribute-element/locales/text-attribute-element.fr.json": "{\n \"meta\": {},\n \"model\": {},\n \"span_4\": \"fr text\"\n}\n", + "/simple-attribute-element/simple-attribute-element.json": "{\n \"meta\": {},\n \"model\": {\n \"standard-input\": {\n \"placeholder\": \"standard HTML5 attribute\"\n },\n \"outer-div:input_2\": {\n \"placeholder\": \"standard HTML5 attribute without id\"\n },\n \"paper-input-element\": {\n \"label\": \"paper-input label\",\n \"error-message\": \"paper-input error message\",\n \"placeholder\": \"paper-input placeholder\"\n },\n \"outer-div:paper-input_4\": {\n \"label\": \"paper-input label without id\",\n \"error-message\": \"paper-input error message without id\",\n \"placeholder\": \"paper-input placeholder without id\"\n },\n \"pie-chart\": {\n \"options\": {\n \"title\": \"Distribution of days in 2001H1\"\n },\n \"cols\": [\n {\n \"label\": \"Month\",\n \"type\": \"string\"\n },\n {\n \"label\": \"Days\",\n \"type\": \"number\"\n }\n ],\n \"rows\": [\n [\n \"Jan\",\n 31\n ],\n [\n \"Feb\",\n 28\n ],\n [\n \"Mar\",\n 31\n ],\n [\n \"Apr\",\n 30\n ],\n [\n \"May\",\n 31\n ],\n [\n \"Jun\",\n 30\n ]\n ]\n },\n \"column-chart\": {\n \"options\": {\n \"title\": \"Inventory\"\n },\n \"data\": [\n [\n \"Year\",\n \"Things\",\n \"Stuff\"\n ],\n [\n \"2004\",\n 1000,\n 400\n ],\n [\n \"2005\",\n 1170,\n 460\n ],\n [\n \"2006\",\n 660,\n 1120\n ],\n [\n \"2007\",\n 1030,\n 540\n ]\n ]\n },\n \"custom-attr\": {\n \"custom-text-attr1\": \"custom text attribute 1\",\n \"custom-text-attr2\": \"custom text attribute 2\",\n \"custom-text-attr3\": \"custom text attribute 3\"\n },\n \"selective-attr\": {\n \"custom-text-attr4\": [\n \"{1} custom-text-attr4 attribute with param {2} and param {3} {4}\",\n \"{{text.ordinary-div}}\",\n \"{{text.ordinary-div}}\",\n \"[[text.ordinary-div]]\",\n \"{{text.ordinary-div}}\"\n ],\n \"custom-text-attr5\": [\n \"[[text.ordinary-div]]\",\n \" custom-text-attr5 attribute with param \",\n \"{{or('',text.ordinary-div)}}\",\n \" and param \",\n \"[[text.ordinary-div]]\"\n ],\n \"i18n-target\": [\n \"i18n-target attribute with param {1} and param {2}\",\n \"{{text.ordinary-div}}\",\n \"[[text.ordinary-div]]\"\n ],\n \"i18n-target2\": [\n \"i18n-target2 attribute with param \",\n \"{{or('',text.ordinary-div)}}\",\n \" and param \",\n \"[[text.ordinary-div]]\"\n ]\n },\n \"selective-attr2\": {\n \"i18n-target\": \"i18n-target attribute 2\"\n },\n \"selective-attr3\": {\n \"i18n-target6\": \"i18n-target6 attribute 2\"\n },\n \"selective-attr4\": {\n \"i18n-target6\": \"i18n-target6 attribute 3\"\n },\n \"json-data-id\": {\n \"attr1\": \"this attr1 is extracted\",\n \"i18n-target-attr\": \"this attribute is also extracted\"\n },\n \"template_2:json-data_1\": {\n \"attr1\": \"this attr1 without id is extracted\",\n \"i18n-target-attr\": \"this attribute without id is also extracted\"\n }\n },\n \"ordinary-div\": \"text 1\"\n}", + "/simple-attribute-element/text-attribute-element.json": "{\n \"meta\": {},\n \"model\": {},\n \"span_4\": \"text\"\n}", + "/simple-text-dom-bind.json": "{\n \"meta\": {},\n \"model\": {},\n \"text\": \" outermost text at the beginning \",\n \"h1_3\": \"outermost header 1\",\n \"text_4\": \" outermost text in the middle \",\n \"span_5\": \"simple text without id\",\n \"span_6\": \"simple text without id 2\",\n \"label-1\": \"simple text with id\",\n \"label-2\": \"simple text with id 2\",\n \"div_9:span\": \"simple text within div\",\n \"div_9:span_1\": \"simple text within div 2\",\n \"div_9:div_2:div\": \"great grandchild text within div\",\n \"div_10:text\": \" simple text as the first element in div \",\n \"div_10:span_1\": \"simple text within div\",\n \"div_10:text_2\": \" simple text in the middle of div \",\n \"div_10:span_3\": \"simple text within div 2\",\n \"div_10:div_4:div\": \"great grandchild text within div\",\n \"div_10:text_5\": \" simple text at the last element in div \",\n \"toplevel-div:span\": \"simple text within div\",\n \"toplevel-div:span_1\": \"simple text within div 2\",\n \"third-level-div\": \"great grandchild text within div\",\n \"second-level-div:div_1\": \"great grandchild text within div without id\",\n \"div_12:ul:li\": \"line item without id 1\",\n \"div_12:ul:li_1\": \"line item without id 2\",\n \"div_12:ul:li_2\": \"line item without id 3\",\n \"line-items:li\": \"line item with id 1\",\n \"line-items:li_1\": \"line item with id 2\",\n \"line-items:li_2\": \"line item with id 3\",\n \"p_13\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"parameters\",\n \"\"\n ],\n \"paragraph\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"id\",\n \"\"\n ],\n \"text_15\": \" outermost text at the end \"\n}", + "/simple-text-element/locales/simple-text-element.fr.json": "{\n \"model\": {},\n \"text\": \" fr outermost text at the beginning \",\n \"h1_3\": \"fr outermost header 1\",\n \"text_4\": \" fr outermost text in the middle \",\n \"span_5\": \"fr simple text without id\",\n \"span_6\": \"fr simple text without id 2\",\n \"label-1\": \"fr simple text with id\",\n \"label-2\": \"fr simple text with id 2\",\n \"div_9:span\": \"fr simple text within div\",\n \"div_9:span_1\": \"fr simple text within div 2\",\n \"div_9:div_2:div\": \"fr great grandchild text within div\",\n \"div_10:text\": \" fr simple text as the first element in div \",\n \"div_10:span_1\": \"fr simple text within div\",\n \"div_10:text_2\": \" fr simple text in the middle of div \",\n \"div_10:span_3\": \"fr simple text within div 2\",\n \"div_10:div_4:div\": \"fr great grandchild text within div\",\n \"div_10:text_5\": \" fr simple text at the last element in div \",\n \"toplevel-div:span\": \"fr simple text within div\",\n \"toplevel-div:span_1\": \"fr simple text within div 2\",\n \"third-level-div\": \"fr great grandchild text within div\",\n \"second-level-div:div_1\": \"fr great grandchild text within div without id\",\n \"div_12:ul:li\": \"fr line item without id 1\",\n \"div_12:ul:li_1\": \"fr line item without id 2\",\n \"div_12:ul:li_2\": \"fr line item without id 3\",\n \"line-items:li\": \"fr line item with id 1\",\n \"line-items:li_1\": \"fr line item with id 2\",\n \"line-items:li_2\": \"fr line item with id 3\",\n \"p_13\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"fr parameters\",\n \"fr \"\n ],\n \"paragraph\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"fr id\",\n \"fr \"\n ],\n \"text_15\": \" fr outermost text at the end \"\n}\n", + "/simple-text-element/locales/simple-text-element.ru.json": "{\n \"model\": {},\n \"text\": \" ru outermost text at the beginning \",\n \"h1_3\": \"ru outermost header 1\",\n \"text_4\": \" ru outermost text in the middle \",\n \"span_5\": \"ru simple text without id\",\n \"span_6\": \"ru simple text without id 2\",\n \"label-1\": \"ru simple text with id\",\n \"label-2\": \"ru simple text with id 2\",\n \"div_9:span\": \"ru simple text within div\",\n \"div_9:span_1\": \"ru simple text within div 2\",\n \"div_9:div_2:div\": \"ru great grandchild text within div\",\n \"div_10:text\": \" ru simple text as the first element in div \",\n \"div_10:span_1\": \"ru simple text within div\",\n \"div_10:text_2\": \" ru simple text in the middle of div \",\n \"div_10:span_3\": \"ru simple text within div 2\",\n \"div_10:div_4:div\": \"ru great grandchild text within div\",\n \"div_10:text_5\": \" ru simple text at the last element in div \",\n \"toplevel-div:span\": \"ru simple text within div\",\n \"toplevel-div:span_1\": \"ru simple text within div 2\",\n \"third-level-div\": \"ru great grandchild text within div\",\n \"second-level-div:div_1\": \"ru great grandchild text within div without id\",\n \"div_12:ul:li\": \"ru line item without id 1\",\n \"div_12:ul:li_1\": \"ru line item without id 2\",\n \"div_12:ul:li_2\": \"ru line item without id 3\",\n \"line-items:li\": \"ru line item with id 1\",\n \"line-items:li_1\": \"ru line item with id 2\",\n \"line-items:li_2\": \"ru line item with id 3\",\n \"p_13\": [\n \"ru A paragraph with {1} is converted to {2}.\",\n \"ru parameters\",\n \"ru \"\n ],\n \"paragraph\": [\n \"ru A paragraph with {1} is converted to {2}.\",\n \"ru id\",\n \"ru \"\n ],\n \"text_15\": \" ru outermost text at the end \"\n}\n", + "/simple-text-element/simple-text-element.json": "{\n \"meta\": {},\n \"model\": {},\n \"text\": \" outermost text at the beginning \",\n \"h1_3\": \"outermost header 1\",\n \"text_4\": \" outermost text in the middle \",\n \"span_5\": \"simple text without id\",\n \"span_6\": \"simple text without id 2\",\n \"label-1\": \"simple text with id\",\n \"label-2\": \"simple text with id 2\",\n \"div_9:span\": \"simple text within div\",\n \"div_9:span_1\": \"simple text within div 2\",\n \"div_9:div_2:div\": \"great grandchild text within div\",\n \"div_10:text\": \" simple text as the first element in div \",\n \"div_10:span_1\": \"simple text within div\",\n \"div_10:text_2\": \" simple text in the middle of div \",\n \"div_10:span_3\": \"simple text within div 2\",\n \"div_10:div_4:div\": \"great grandchild text within div\",\n \"div_10:text_5\": \" simple text at the last element in div \",\n \"toplevel-div:span\": \"simple text within div\",\n \"toplevel-div:span_1\": \"simple text within div 2\",\n \"third-level-div\": \"great grandchild text within div\",\n \"second-level-div:div_1\": \"great grandchild text within div without id\",\n \"div_12:ul:li\": \"line item without id 1\",\n \"div_12:ul:li_1\": \"line item without id 2\",\n \"div_12:ul:li_2\": \"line item without id 3\",\n \"line-items:li\": \"line item with id 1\",\n \"line-items:li_1\": \"line item with id 2\",\n \"line-items:li_2\": \"line item with id 3\",\n \"p_13\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"parameters\",\n \"\"\n ],\n \"paragraph\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"id\",\n \"\"\n ],\n \"text_15\": \" outermost text at the end \"\n}", + "/simple-text-id-element/locales/simple-text-id-element.fr.json": "{\n \"model\": {},\n \"text\": \" fr outermost text at the beginning \",\n \"h1_3\": \"fr outermost header 1\",\n \"text_4\": \" fr outermost text in the middle \",\n \"span_5\": \"fr simple text without id\",\n \"span_6\": \"fr simple text without id 2\",\n \"label-1\": \"fr simple text with id\",\n \"label-2\": \"fr simple text with id 2\",\n \"div_9:span\": \"fr simple text within div\",\n \"div_9:span_1\": \"fr simple text within div 2\",\n \"div_9:div_2:div\": \"fr great grandchild text within div\",\n \"div_10:text\": \" fr simple text as the first element in div \",\n \"div_10:span_1\": \"fr simple text within div\",\n \"div_10:text_2\": \" fr simple text in the middle of div \",\n \"div_10:span_3\": \"fr simple text within div 2\",\n \"div_10:div_4:div\": \"fr great grandchild text within div\",\n \"div_10:text_5\": \" fr simple text at the last element in div \",\n \"toplevel-div:span\": \"fr simple text within div\",\n \"toplevel-div:span_1\": \"fr simple text within div 2\",\n \"second-level-div\": [\n \" fr {1}\\n {2} \",\n \"fr great grandchild text within div\",\n \"fr great grandchild text within div without id\"\n ],\n \"div_12:ul:li\": \"fr line item without id 1\",\n \"div_12:ul:li_1\": \"fr line item without id 2\",\n \"div_12:ul:li_2\": \"fr line item without id 3\",\n \"line-items\": [\n \" fr {1}\\n {2}\\n {3} \",\n \"fr line item with id 1\",\n \"fr line item with id 2\",\n \"fr line item with id 3\"\n ],\n \"p_13\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"fr parameters\",\n \"fr \"\n ],\n \"paragraph\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"fr id\",\n \"fr \"\n ],\n \"text_15\": \" fr outermost text at the end \"\n}\n", + "/simple-text-id-element/simple-text-id-element.json": "{\n \"meta\": {},\n \"model\": {},\n \"text\": \" outermost text at the beginning \",\n \"h1_3\": \"outermost header 1\",\n \"text_4\": \" outermost text in the middle \",\n \"span_5\": \"simple text without id\",\n \"span_6\": \"simple text without id 2\",\n \"label-1\": \"simple text with id\",\n \"label-2\": \"simple text with id 2\",\n \"div_9:span\": \"simple text within div\",\n \"div_9:span_1\": \"simple text within div 2\",\n \"div_9:div_2:div\": \"great grandchild text within div\",\n \"div_10:text\": \" simple text as the first element in div \",\n \"div_10:span_1\": \"simple text within div\",\n \"div_10:text_2\": \" simple text in the middle of div \",\n \"div_10:span_3\": \"simple text within div 2\",\n \"div_10:div_4:div\": \"great grandchild text within div\",\n \"div_10:text_5\": \" simple text at the last element in div \",\n \"toplevel-div:span\": \"simple text within div\",\n \"toplevel-div:span_1\": \"simple text within div 2\",\n \"second-level-div\": [\n \" {1}\\n {2} \",\n \"great grandchild text within div\",\n \"great grandchild text within div without id\"\n ],\n \"div_12:ul:li\": \"line item without id 1\",\n \"div_12:ul:li_1\": \"line item without id 2\",\n \"div_12:ul:li_2\": \"line item without id 3\",\n \"line-items\": [\n \" {1}\\n {2}\\n {3} \",\n \"line item with id 1\",\n \"line item with id 2\",\n \"line item with id 3\"\n ],\n \"p_13\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"parameters\",\n \"\"\n ],\n \"paragraph\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"id\",\n \"\"\n ],\n \"text_15\": \" outermost text at the end \"\n}", + "/template-default-lang/locales/null-template-default-lang-element.ja.json": "", + "/template-default-lang/locales/null-template-default-lang-element.zh-Hans-CN.json": "{\n \"meta\": {},\n \"model\": {},\n \"text\": \" zh-Hans-CN outermost text at the beginning \",\n \"h1_3\": \"zh-Hans-CN outermost header 1\",\n \"text_4\": \" zh-Hans-CN outermost text in the middle \",\n \"span_5\": \"zh-Hans-CN simple text without id\",\n \"span_6\": \"zh-Hans-CN simple text without id 2\",\n \"label-1\": \"zh-Hans-CN simple text with id\",\n \"label-2\": \"zh-Hans-CN simple text with id 2\",\n \"div_9:span\": \"zh-Hans-CN simple text within div\",\n \"div_9:span_1\": \"zh-Hans-CN simple text within div 2\",\n \"div_9:div_2:div\": \"zh-Hans-CN great grandchild text within div\",\n \"div_10:text\": \" zh-Hans-CN simple text as the first element in div \",\n \"div_10:span_1\": \"zh-Hans-CN simple text within div\",\n \"div_10:text_2\": \" zh-Hans-CN simple text in the middle of div \",\n \"div_10:span_3\": \"zh-Hans-CN simple text within div 2\",\n \"div_10:div_4:div\": \"zh-Hans-CN great grandchild text within div\",\n \"div_10:text_5\": \" zh-Hans-CN simple text at the last element in div \",\n \"toplevel-div:span\": \"zh-Hans-CN simple text within div\",\n \"toplevel-div:span_1\": \"zh-Hans-CN simple text within div 2\",\n \"third-level-div\": \"zh-Hans-CN great grandchild text within div\",\n \"second-level-div:div_1\": \"zh-Hans-CN great grandchild text within div without id\",\n \"div_12:ul:li\": \"zh-Hans-CN line item without id 1\",\n \"div_12:ul:li_1\": \"zh-Hans-CN line item without id 2\",\n \"div_12:ul:li_2\": \"zh-Hans-CN line item without id 3\",\n \"line-items:li\": \"zh-Hans-CN line item with id 1\",\n \"line-items:li_1\": \"zh-Hans-CN line item with id 2\",\n \"line-items:li_2\": \"zh-Hans-CN line item with id 3\",\n \"p_13\": [\n \"zh-Hans-CN A paragraph with {1} is converted to {2}.\",\n \"zh-Hans-CN parameters\",\n \"zh-Hans-CN \"\n ],\n \"paragraph\": [\n \"zh-Hans-CN A paragraph with {1} is converted to {2}.\",\n \"zh-Hans-CN id\",\n \"zh-Hans-CN \"\n ],\n \"text_15\": \" zh-Hans-CN outermost text at the end \"\n}", + "/template-default-lang/locales/template-default-lang-element.zh-Hans-CN.json": "{\n \"meta\": {},\n \"model\": {},\n \"text\": \" zh-Hans-CN outermost text at the beginning \",\n \"h1_3\": \"zh-Hans-CN outermost header 1\",\n \"text_4\": \" zh-Hans-CN outermost text in the middle \",\n \"span_5\": \"zh-Hans-CN simple text without id\",\n \"span_6\": \"zh-Hans-CN simple text without id 2\",\n \"label-1\": \"zh-Hans-CN simple text with id\",\n \"label-2\": \"zh-Hans-CN simple text with id 2\",\n \"div_9:span\": \"zh-Hans-CN simple text within div\",\n \"div_9:span_1\": \"zh-Hans-CN simple text within div 2\",\n \"div_9:div_2:div\": \"zh-Hans-CN great grandchild text within div\",\n \"div_10:text\": \" zh-Hans-CN simple text as the first element in div \",\n \"div_10:span_1\": \"zh-Hans-CN simple text within div\",\n \"div_10:text_2\": \" zh-Hans-CN simple text in the middle of div \",\n \"div_10:span_3\": \"zh-Hans-CN simple text within div 2\",\n \"div_10:div_4:div\": \"zh-Hans-CN great grandchild text within div\",\n \"div_10:text_5\": \" zh-Hans-CN simple text at the last element in div \",\n \"toplevel-div:span\": \"zh-Hans-CN simple text within div\",\n \"toplevel-div:span_1\": \"zh-Hans-CN simple text within div 2\",\n \"third-level-div\": \"zh-Hans-CN great grandchild text within div\",\n \"second-level-div:div_1\": \"zh-Hans-CN great grandchild text within div without id\",\n \"div_12:ul:li\": \"zh-Hans-CN line item without id 1\",\n \"div_12:ul:li_1\": \"zh-Hans-CN line item without id 2\",\n \"div_12:ul:li_2\": \"zh-Hans-CN line item without id 3\",\n \"line-items:li\": \"zh-Hans-CN line item with id 1\",\n \"line-items:li_1\": \"zh-Hans-CN line item with id 2\",\n \"line-items:li_2\": \"zh-Hans-CN line item with id 3\",\n \"p_13\": [\n \"zh-Hans-CN A paragraph with {1} is converted to {2}.\",\n \"zh-Hans-CN parameters\",\n \"zh-Hans-CN \"\n ],\n \"paragraph\": [\n \"zh-Hans-CN A paragraph with {1} is converted to {2}.\",\n \"zh-Hans-CN id\",\n \"zh-Hans-CN \"\n ],\n \"text_15\": \" zh-Hans-CN outermost text at the end \"\n}", + "/template-default-lang/null-template-default-lang-element.json": "{\n \"meta\": {},\n \"model\": {},\n \"text\": \" outermost text at the beginning \",\n \"h1_3\": \"outermost header 1\",\n \"text_4\": \" outermost text in the middle \",\n \"span_5\": \"simple text without id\",\n \"span_6\": \"simple text without id 2\",\n \"label-1\": \"simple text with id\",\n \"label-2\": \"simple text with id 2\",\n \"div_9:span\": \"simple text within div\",\n \"div_9:span_1\": \"simple text within div 2\",\n \"div_9:div_2:div\": \"great grandchild text within div\",\n \"div_10:text\": \" simple text as the first element in div \",\n \"div_10:span_1\": \"simple text within div\",\n \"div_10:text_2\": \" simple text in the middle of div \",\n \"div_10:span_3\": \"simple text within div 2\",\n \"div_10:div_4:div\": \"great grandchild text within div\",\n \"div_10:text_5\": \" simple text at the last element in div \",\n \"toplevel-div:span\": \"simple text within div\",\n \"toplevel-div:span_1\": \"simple text within div 2\",\n \"third-level-div\": \"great grandchild text within div\",\n \"second-level-div:div_1\": \"great grandchild text within div without id\",\n \"div_12:ul:li\": \"line item without id 1\",\n \"div_12:ul:li_1\": \"line item without id 2\",\n \"div_12:ul:li_2\": \"line item without id 3\",\n \"line-items:li\": \"line item with id 1\",\n \"line-items:li_1\": \"line item with id 2\",\n \"line-items:li_2\": \"line item with id 3\",\n \"p_13\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"parameters\",\n \"\"\n ],\n \"paragraph\": [\n \"A paragraph with {1} is converted to {2}.\",\n \"id\",\n \"\"\n ],\n \"text_15\": \" outermost text at the end \"\n}", + "/template-default-lang/template-default-lang-element.json": "{\n \"meta\": {},\n \"model\": {},\n \"text\": \" fr outermost text at the beginning \",\n \"h1_3\": \"fr outermost header 1\",\n \"text_4\": \" fr outermost text in the middle \",\n \"span_5\": \"fr simple text without id\",\n \"span_6\": \"fr simple text without id 2\",\n \"label-1\": \"fr simple text with id\",\n \"label-2\": \"fr simple text with id 2\",\n \"div_9:span\": \"fr simple text within div\",\n \"div_9:span_1\": \"fr simple text within div 2\",\n \"div_9:div_2:div\": \"fr great grandchild text within div\",\n \"div_10:text\": \" fr simple text as the first element in div \",\n \"div_10:span_1\": \"fr simple text within div\",\n \"div_10:text_2\": \" fr simple text in the middle of div \",\n \"div_10:span_3\": \"fr simple text within div 2\",\n \"div_10:div_4:div\": \"fr great grandchild text within div\",\n \"div_10:text_5\": \" fr simple text at the last element in div \",\n \"toplevel-div:span\": \"fr simple text within div\",\n \"toplevel-div:span_1\": \"fr simple text within div 2\",\n \"third-level-div\": \"fr great grandchild text within div\",\n \"second-level-div:div_1\": \"fr great grandchild text within div without id\",\n \"div_12:ul:li\": \"fr line item without id 1\",\n \"div_12:ul:li_1\": \"fr line item without id 2\",\n \"div_12:ul:li_2\": \"fr line item without id 3\",\n \"line-items:li\": \"fr line item with id 1\",\n \"line-items:li_1\": \"fr line item with id 2\",\n \"line-items:li_2\": \"fr line item with id 3\",\n \"p_13\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"fr parameters\",\n \"fr \"\n ],\n \"paragraph\": [\n \"fr A paragraph with {1} is converted to {2}.\",\n \"fr id\",\n \"fr \"\n ],\n \"text_15\": \" fr outermost text at the end \"\n}" +}; diff --git a/test/preprocess3/fallback-text-element/fallback-text-element.js b/test/preprocess3/fallback-text-element/fallback-text-element.js new file mode 100644 index 00000000..564b413a --- /dev/null +++ b/test/preprocess3/fallback-text-element/fallback-text-element.js @@ -0,0 +1,413 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class FallbackTextElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`); + } + + static get is() { return 'fallback-text-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(FallbackTextElement.is, FallbackTextElement); + } + break; +case 'base-element': + { + class FallbackTextElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`); + } + + static get is() { return 'fallback-text-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(FallbackTextElement.is, FallbackTextElement); + } + break; +case 'thin': + { + Define = class FallbackTextElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + }; + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`), + + is: 'fallback-text-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + listeners: { + 'lang-updated': '_langUpdated' + }, + + ready: function () { + //this.observeHtmlLang = false; + }, + + attached: function () { + }, + + _langUpdated: function (e) { + console.log(this.is, 'lang-updated', e.detail); + if (dom(e).rootTarget === this) { + this.model = deepcopy(this.text.model); + } + } + }); + } + break; +} diff --git a/test/preprocess3/fallback-text-element/fallback-text-element.json b/test/preprocess3/fallback-text-element/fallback-text-element.json new file mode 100644 index 00000000..f9b2ccf7 --- /dev/null +++ b/test/preprocess3/fallback-text-element/fallback-text-element.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "model": {}, + "text": " outermost text at the beginning ", + "h1_3": "outermost header 1", + "text_4": " outermost text in the middle ", + "span_5": "simple text without id", + "span_6": "simple text without id 2", + "label-1": "simple text with id", + "label-2": "simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "simple text within div", + "toplevel-div:span_1": "simple text within div 2", + "third-level-div": "great grandchild text within div", + "second-level-div:div_1": "great grandchild text within div without id", + "div_12:ul:li": "line item without id 1", + "div_12:ul:li_1": "line item without id 2", + "div_12:ul:li_2": "line item without id 3", + "line-items:li": "line item with id 1", + "line-items:li_1": "line item with id 2", + "line-items:li_2": "line item with id 3", + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "parameters", + "" + ], + "paragraph": [ + "A paragraph with {1} is converted to {2}.", + "id", + "" + ], + "text_15": " outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/fallback-text-element/locales/fallback-text-element.fr-CA.json b/test/preprocess3/fallback-text-element/locales/fallback-text-element.fr-CA.json new file mode 100755 index 00000000..79f9c72f --- /dev/null +++ b/test/preprocess3/fallback-text-element/locales/fallback-text-element.fr-CA.json @@ -0,0 +1,114 @@ +{ + "meta": { + "todo": [ + { + "op": "add", + "path": "/div_9:span", + "value": "simple text within div" + }, + { + "op": "add", + "path": "/div_9:span_1", + "value": "simple text within div 2" + }, + { + "op": "add", + "path": "/div_9:div_2:div", + "value": "great grandchild text within div" + }, + { + "op": "add", + "path": "/div_10:text", + "value": " simple text as the first element in div " + }, + { + "op": "add", + "path": "/div_10:text_2", + "value": " simple text in the middle of div " + }, + { + "op": "add", + "path": "/div_10:span_3", + "value": "simple text within div 2" + }, + { + "op": "add", + "path": "/div_10:div_4:div", + "value": "great grandchild text within div" + }, + { + "op": "add", + "path": "/div_10:text_5", + "value": " simple text at the last element in div " + }, + { + "op": "add", + "path": "/div_12:ul:li", + "value": "line item without id 1" + }, + { + "op": "add", + "path": "/div_12:ul:li_1", + "value": "line item without id 2" + }, + { + "op": "add", + "path": "/div_12:ul:li_2", + "value": "line item without id 3" + }, + { + "op": "add", + "path": "/line-items:li", + "value": "line item with id 1" + }, + { + "op": "add", + "path": "/line-items:li_1", + "value": "line item with id 2" + }, + { + "op": "add", + "path": "/line-items:li_2", + "value": "line item with id 3" + } + ] + }, + "model": {}, + "text": "fr-CA outermost text at the beginning ", + "h1_3": "fr-CA outermost header 1", + "text_4": "fr-CA outermost text in the middle ", + "span_5": "fr-CA simple text without id", + "span_6": "fr-CA simple text without id 2", + "label-1": "fr-CA simple text with id", + "label-2": "fr-CA simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "fr-CA simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "fr-CA simple text within div", + "toplevel-div:span_1": "fr-CA simple text within div 2", + "third-level-div": "fr-CA great grandchild text within div", + "second-level-div:div_1": "fr-CA great grandchild text within div without id", + "div_12:ul:li": "fr line item without id 1", + "div_12:ul:li_1": "fr line item without id 2", + "div_12:ul:li_2": "fr line item without id 3", + "line-items:li": "fr line item with id 1", + "line-items:li_1": "fr line item with id 2", + "line-items:li_2": "fr line item with id 3", + "p_13": [ + "fr-CA A paragraph with {1} is converted to {2}.", + "fr-CA parameters", + "fr-CA " + ], + "paragraph": [ + "fr-CA A paragraph with {1} is converted to {2}.", + "fr-CA id", + "fr-CA " + ], + "text_15": "fr-CA outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/fallback-text-element/locales/fallback-text-element.fr.json b/test/preprocess3/fallback-text-element/locales/fallback-text-element.fr.json new file mode 100755 index 00000000..9c7ea5bb --- /dev/null +++ b/test/preprocess3/fallback-text-element/locales/fallback-text-element.fr.json @@ -0,0 +1,89 @@ +{ + "meta": { + "todo": [ + { + "op": "add", + "path": "/div_9:span", + "value": "simple text within div" + }, + { + "op": "add", + "path": "/div_9:span_1", + "value": "simple text within div 2" + }, + { + "op": "add", + "path": "/div_9:div_2:div", + "value": "great grandchild text within div" + }, + { + "op": "add", + "path": "/div_10:text", + "value": " simple text as the first element in div " + }, + { + "op": "add", + "path": "/div_10:span_1", + "value": "simple text within div" + }, + { + "op": "add", + "path": "/div_10:text_2", + "value": " simple text in the middle of div " + }, + { + "op": "add", + "path": "/div_10:span_3", + "value": "simple text within div 2" + }, + { + "op": "add", + "path": "/div_10:div_4:div", + "value": "great grandchild text within div" + }, + { + "op": "add", + "path": "/div_10:text_5", + "value": " simple text at the last element in div " + } + ] + }, + "model": {}, + "text": "fr outermost text at the beginning ", + "h1_3": "fr outermost header 1", + "text_4": "fr outermost text in the middle ", + "span_5": "fr simple text without id", + "span_6": "fr simple text without id 2", + "label-1": "fr simple text with id", + "label-2": "fr simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "fr simple text within div", + "toplevel-div:span_1": "fr simple text within div 2", + "third-level-div": "fr great grandchild text within div", + "second-level-div:div_1": "fr great grandchild text within div without id", + "div_12:ul:li": "fr line item without id 1", + "div_12:ul:li_1": "fr line item without id 2", + "div_12:ul:li_2": "fr line item without id 3", + "line-items:li": "fr line item with id 1", + "line-items:li_1": "fr line item with id 2", + "line-items:li_2": "fr line item with id 3", + "p_13": [ + "fr A paragraph with {1} is converted to {2}.", + "fr parameters", + "fr " + ], + "paragraph": [ + "fr A paragraph with {1} is converted to {2}.", + "fr id", + "fr " + ], + "text_15": "fr outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/locales/compound-binding-dom-bind.fr.json b/test/preprocess3/locales/compound-binding-dom-bind.fr.json new file mode 100755 index 00000000..fef07d0a --- /dev/null +++ b/test/preprocess3/locales/compound-binding-dom-bind.fr.json @@ -0,0 +1,153 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "text": [ + " fr outermost text at the beginning with compound {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "h1_3": [ + "fr outermost header 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "text_4": [ + " fr outermost text in the middle with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "span_5": [ + "fr simple text without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "span_6": [ + "fr simple text without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-1": [ + "fr simple text with id and {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-2": [ + "fr simple text with id and {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:span": [ + "fr simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_9:span_1": [ + "fr simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:div_2:div": [ + "fr great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text": [ + " fr simple text as the first element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_1": [ + "fr simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_2": [ + " fr simple text in the middle of div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_3": [ + "fr simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_10:div_4:div": [ + "fr great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_5": [ + " fr simple text at the last element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span": [ + "fr simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span_1": [ + "fr simple text within div 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "third-level-div": [ + "fr great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "second-level-div:div_1": [ + "fr great grandchild text within div without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li": [ + "fr line item without id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_1": [ + "fr line item without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_2": [ + "fr line item without id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li": [ + "fr line item with id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_1": [ + "fr line item with id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_2": [ + "fr line item with id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "p_13": [ + "fr A paragraph with {1} is converted to {2}.", + "{{param1}}", + "{{param2}}" + ], + "paragraph": [ + "fr A paragraph with {1}, {2}, and {3} is converted to {4}.", + "fr id", + "{{param1}}", + "{{param2}}", + "fr " + ], + "text_15": [ + " fr outermost text at the end with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ] +} \ No newline at end of file diff --git a/test/preprocess3/locales/simple-attribute-dom-bind.fr.json b/test/preprocess3/locales/simple-attribute-dom-bind.fr.json new file mode 100755 index 00000000..4161d2ad --- /dev/null +++ b/test/preprocess3/locales/simple-attribute-dom-bind.fr.json @@ -0,0 +1,146 @@ +{ + "meta": { + "todo": [] + }, + "model": { + "standard-input": { + "placeholder": "fr standard HTML5 attribute" + }, + "outer-div:input_2": { + "placeholder": "fr standard HTML5 attribute without id" + }, + "paper-input-element": { + "label": "fr paper-input label", + "error-message": "fr paper-input error message", + "placeholder": "fr paper-input placeholder" + }, + "outer-div:paper-input_4": { + "label": "fr paper-input label without id", + "error-message": "fr paper-input error message without id", + "placeholder": "fr paper-input placeholder without id" + }, + "pie-chart": { + "options": { + "title": "fr Distribution of days in 2001H1" + }, + "cols": [ + { + "label": "fr Month", + "type": "string" + }, + { + "label": "fr Days", + "type": "number" + } + ], + "rows": [ + [ + "fr Jan", + 31 + ], + [ + "fr Feb", + 28 + ], + [ + "fr Mar", + 31 + ], + [ + "fr Apr", + 30 + ], + [ + "fr May", + 31 + ], + [ + "fr Jun", + 30 + ] + ] + }, + "column-chart": { + "options": { + "title": "fr Inventory" + }, + "data": [ + [ + "fr Year", + "fr Things", + "fr Stuff" + ], + [ + "2004", + 1000, + 400 + ], + [ + "2005", + 1170, + 460 + ], + [ + "2006", + 660, + 1120 + ], + [ + "2007", + 1030, + 540 + ] + ] + }, + "custom-attr": { + "custom-text-attr1": "fr custom text attribute 1", + "custom-text-attr2": "fr custom text attribute 2", + "custom-text-attr3": "fr custom text attribute 3" + }, + "selective-attr": { + "custom-text-attr4": [ + "fr {1} custom-text-attr4 attribute with param {2} and param {3} {4}", + "{{text.ordinary-div}}", + "{{text.ordinary-div}}", + "[[text.ordinary-div]]", + "{{text.ordinary-div}}" + ], + "custom-text-attr5": [ + "[[text.ordinary-div]]", + " fr custom-text-attr5 attribute with param ", + "{{or('',text.ordinary-div)}}", + " fr and param ", + "[[text.ordinary-div]]" + ], + "i18n-target": [ + "fr i18n-target attribute with param {1} and param {2}", + "{{text.ordinary-div}}", + "[[text.ordinary-div]]" + ], + "i18n-target2": [ + "fr i18n-target2 attribute with param ", + "{{or('',text.ordinary-div)}}", + " fr and param ", + "[[text.ordinary-div]]" + ] + }, + "selective-attr2": { + "i18n-target": "fr i18n-target attribute 2" + }, + "selective-attr3": { + "i18n-target6": "fr i18n-target6 attribute 2" + }, + "selective-attr4": { + "i18n-target6": "fr i18n-target6 attribute 3" + }, + "json-data-id": { + "attr1": "fr this attr1 is extracted", + "i18n-target-attr": "fr this attribute is also extracted" + }, + "template_2:json-data_1": { + "attr1": "fr this attr1 without id is extracted", + "i18n-target-attr": "fr this attribute without id is also extracted" + } + }, + "ordinary-div": "fr text 1" +} \ No newline at end of file diff --git a/test/preprocess3/locales/simple-text-dom-bind.fr.json b/test/preprocess3/locales/simple-text-dom-bind.fr.json new file mode 100755 index 00000000..d993e702 --- /dev/null +++ b/test/preprocess3/locales/simple-text-dom-bind.fr.json @@ -0,0 +1,43 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "text": " fr outermost text at the beginning ", + "h1_3": "fr outermost header 1", + "text_4": " fr outermost text in the middle ", + "span_5": "fr simple text without id", + "span_6": "fr simple text without id 2", + "label-1": "fr simple text with id", + "label-2": "fr simple text with id 2", + "div_9:span": "fr simple text within div", + "div_9:span_1": "fr simple text within div 2", + "div_9:div_2:div": "fr great grandchild text within div", + "div_10:text": " fr simple text as the first element in div ", + "div_10:span_1": "fr simple text within div", + "div_10:text_2": " fr simple text in the middle of div ", + "div_10:span_3": "fr simple text within div 2", + "div_10:div_4:div": "fr great grandchild text within div", + "div_10:text_5": " fr simple text at the last element in div ", + "toplevel-div:span": "fr simple text within div", + "toplevel-div:span_1": "fr simple text within div 2", + "third-level-div": "fr great grandchild text within div", + "second-level-div:div_1": "fr great grandchild text within div without id", + "div_12:ul:li": "fr line item without id 1", + "div_12:ul:li_1": "fr line item without id 2", + "div_12:ul:li_2": "fr line item without id 3", + "line-items:li": "fr line item with id 1", + "line-items:li_1": "fr line item with id 2", + "line-items:li_2": "fr line item with id 3", + "p_13": [ + "fr A paragraph with {1} is converted to {2}.", + "fr parameters", + "fr " + ], + "paragraph": [ + "fr A paragraph with {1} is converted to {2}.", + "fr id", + "fr " + ], + "text_15": " fr outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/multiple-case-test-imports.js b/test/preprocess3/multiple-case-test-imports.js new file mode 100644 index 00000000..859606cf --- /dev/null +++ b/test/preprocess3/multiple-case-test-imports.js @@ -0,0 +1,22 @@ +import './fake-server.js'; +import './test-runner.js'; +import '../../i18n-element.js'; +import '../../define-element.js'; +import '../../i18n-dom-bind.js'; +import './multiple-case/multiple-element.js'; +import './multiple-case-test-suites.js'; + +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +/* + + +*/ +/* + FIXME(polymer-modulizer): the above comments were extracted + from HTML and may be out of place here. Review them and + then delete this comment! +*/ +; diff --git a/test/preprocess3/multiple-case-test-suites.js b/test/preprocess3/multiple-case-test-suites.js new file mode 100644 index 00000000..0fdb8034 --- /dev/null +++ b/test/preprocess3/multiple-case-test-suites.js @@ -0,0 +1,47 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import './test-runner.js'; +suite('I18nElement with ' + + (window.location.href.indexOf('?dom=Shadow') >= 0 ? 'Shadow DOM' : 'Shady DOM') + + (' in ' + syntax + ' syntax'), + function () { + + var lang0 = ''; + var lang1 = 'en'; + var lang2 = 'fr'; + var lang3 = 'ja'; + var lang4 = 'fr-CA'; + var lang5 = 'zh-Hans-CN'; + var count1 = 100; + + var localDOM_multiple_element = [ + { select: 'div item-element', '$.label.textContent': 'A' } + ]; + + var suites = [ + s('multiple element', null, { + fixture: 'multiple-element-fixture', + fixtureModel: { observeHtmlLang: false, lang: lang0, count: count1 }, + assign: { lang: lang1 }, + lang: lang1, + effectiveLang: lang1, + templateDefaultLang: lang1, + observeHtmlLang: false, + event: 'local-dom-ready', + text: { model: {} }, + model: {}, + localDOM: localDOM_multiple_element, + lightDOM: undefined + }), + s(lang2 + ' multiple element', 'multiple element', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }) + ]; + + suitesRunner(suites, 3000); + +}); diff --git a/test/preprocess3/multiple-case-test.html b/test/preprocess3/multiple-case-test.html new file mode 100644 index 00000000..af75bb7b --- /dev/null +++ b/test/preprocess3/multiple-case-test.html @@ -0,0 +1,31 @@ + + + + + + + + + + + +

+ + + + + + + \ No newline at end of file diff --git a/test/preprocess3/multiple-case/item-element.js b/test/preprocess3/multiple-case/item-element.js new file mode 100644 index 00000000..1f25ab87 --- /dev/null +++ b/test/preprocess3/multiple-case/item-element.js @@ -0,0 +1,110 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class ItemElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + {{text.label}} + +`); + } + + static get is() { return 'item-element' } + } + customElements.define(ItemElement.is, ItemElement); + } + break; +case 'base-element': + { + class ItemElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + {{text.label}} + +`); + } + + static get is() { return 'item-element' } + } + customElements.define(ItemElement.is, ItemElement); + } + break; +case 'thin': + { + Define = class ItemElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + } + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + {{text.label}} + +`), + + is: 'item-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ] + }); + } + break; +} diff --git a/test/preprocess3/multiple-case/item-element.json b/test/preprocess3/multiple-case/item-element.json new file mode 100644 index 00000000..ccab72af --- /dev/null +++ b/test/preprocess3/multiple-case/item-element.json @@ -0,0 +1,5 @@ +{ + "meta": {}, + "model": {}, + "label": "A" +} \ No newline at end of file diff --git a/test/preprocess3/multiple-case/locales/item-element.fr.json b/test/preprocess3/multiple-case/locales/item-element.fr.json new file mode 100755 index 00000000..b95ced4b --- /dev/null +++ b/test/preprocess3/multiple-case/locales/item-element.fr.json @@ -0,0 +1,7 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "label": "fr A" +} \ No newline at end of file diff --git a/test/preprocess3/multiple-case/locales/multiple-element.fr.json b/test/preprocess3/multiple-case/locales/multiple-element.fr.json new file mode 100644 index 00000000..3867b299 --- /dev/null +++ b/test/preprocess3/multiple-case/locales/multiple-element.fr.json @@ -0,0 +1,6 @@ +{ + "meta": { + "todo": [] + }, + "model": {} +} \ No newline at end of file diff --git a/test/preprocess3/multiple-case/multiple-element.js b/test/preprocess3/multiple-case/multiple-element.js new file mode 100644 index 00000000..5f3fd023 --- /dev/null +++ b/test/preprocess3/multiple-case/multiple-element.js @@ -0,0 +1,365 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import './item-element.js'; +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class MultipleElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +
+ +
+
+ +`); + } + + static get is() { return 'multiple-element' } + + static get properties () { + return { + count: { + type: Number, + value: 100 + } + } + } + + ready() { + this.addEventListener('lang-updated', this.langUpdated); + super.ready(); + } + + getArray(count) { + var a = []; + for (var i = 0; i < count; i++) { + a.push(i); + } + return a; + } + + domChanged(e) { + var nodes = dom(this.root).querySelectorAll('item-element'); + if (this.lang === 'en' && this.effectiveLang === '') { + this.effectiveLang = 'en'; + } + //console.log('multiple-element: dom-change count = ' + nodes.length + ' lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + if (nodes.length === this.count && + (this.lang === this.effectiveLang || + (this.effectiveLang === '' && this.lang ==='en'))) { + Array.prototype.forEach.call(nodes, function (node) { + this.$.save.appendChild(node); + }.bind(this)); + //console.log('multiple-element: local-dom-ready'); + this.async(function () { this.fire('local-dom-ready'); }, 500); + } + } + + langUpdated(e) { + var target = e.composedPath()[0]; + var lang = target.lang === '' ? 'en' : target.lang; + this.itemLang = this.itemLang || {}; + if (target.tagName.toLowerCase() === 'item-element') { + //console.log('item-element: lang-updated lang = ' + target.lang); + this.itemLang[lang] = this.itemLang[lang] || 0; + this.itemLang[lang]++; + } + //console.log('multiple-element: ' + target.is + ' ' + + // 'lang-updated lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang + + // ' itemLang[' + this.lang + '] = ' + this.itemLang[this.lang]); + if (this.itemLang[this.lang] === this.count) { + //console.log('count reached for ' + this.lang); + this.$.items.render(); + } + return false; + } + } + customElements.define(MultipleElement.is, MultipleElement); + } + break; +case 'base-element': + { + class MultipleElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +
+ +
+
+ +`); + } + + static get is() { return 'multiple-element' } + + static get properties () { + return { + count: { + type: Number, + value: 100 + } + } + } + + ready() { + this.addEventListener('lang-updated', this.langUpdated); + super.ready(); + } + + getArray(count) { + var a = []; + for (var i = 0; i < count; i++) { + a.push(i); + } + return a; + } + + domChanged(e) { + var nodes = dom(this.root).querySelectorAll('item-element'); + if (this.lang === 'en' && this.effectiveLang === '') { + this.effectiveLang = 'en'; + } + //console.log('multiple-element: dom-change count = ' + nodes.length + ' lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + if (nodes.length === this.count && + (this.lang === this.effectiveLang || + (this.effectiveLang === '' && this.lang ==='en'))) { + Array.prototype.forEach.call(nodes, function (node) { + this.$.save.appendChild(node); + }.bind(this)); + //console.log('multiple-element: local-dom-ready'); + this.async(function () { this.fire('local-dom-ready'); }, 500); + } + } + + langUpdated(e) { + var target = e.composedPath()[0]; + var lang = target.lang === '' ? 'en' : target.lang; + this.itemLang = this.itemLang || {}; + if (target.tagName.toLowerCase() === 'item-element') { + //console.log('item-element: lang-updated lang = ' + target.lang); + this.itemLang[lang] = this.itemLang[lang] || 0; + this.itemLang[lang]++; + } + //console.log('multiple-element: ' + target.is + ' ' + + // 'lang-updated lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang + + // ' itemLang[' + this.lang + '] = ' + this.itemLang[this.lang]); + if (this.itemLang[this.lang] === this.count) { + //console.log('count reached for ' + this.lang); + this.$.items.render(); + } + return false; + } + } + customElements.define(MultipleElement.is, MultipleElement); + } + break; +case 'thin': + { + Define = class MultipleElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + static get properties () { + return { + count: { + type: Number, + value: 100 + } + } + } + + ready() { + this.addEventListener('lang-updated', this.langUpdated); + super.ready(); + } + + getArray(count) { + var a = []; + for (var i = 0; i < count; i++) { + a.push(i); + } + return a; + } + + domChanged(e) { + var nodes = dom(this.root).querySelectorAll('item-element'); + if (this.lang === 'en' && this.effectiveLang === '') { + this.effectiveLang = 'en'; + } + //console.log('multiple-element: dom-change count = ' + nodes.length + ' lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + if (nodes.length === this.count && + (this.lang === this.effectiveLang || + (this.effectiveLang === '' && this.lang ==='en'))) { + Array.prototype.forEach.call(nodes, function (node) { + this.$.save.appendChild(node); + }.bind(this)); + //console.log('multiple-element: local-dom-ready'); + this.async(function () { this.fire('local-dom-ready'); }, 500); + } + } + + langUpdated(e) { + var target = e.composedPath()[0]; + var lang = target.lang === '' ? 'en' : target.lang; + this.itemLang = this.itemLang || {}; + if (target.tagName.toLowerCase() === 'item-element') { + //console.log('item-element: lang-updated lang = ' + target.lang); + this.itemLang[lang] = this.itemLang[lang] || 0; + this.itemLang[lang]++; + } + //console.log('multiple-element: ' + target.is + ' ' + + // 'lang-updated lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang + + // ' itemLang[' + this.lang + '] = ' + this.itemLang[this.lang]); + if (this.itemLang[this.lang] === this.count) { + //console.log('count reached for ' + this.lang); + this.$.items.render(); + } + return false; + } + } + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +
+ +
+
+ +`), + + is: 'multiple-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + properties: { + count: { + type: Number, + value: 100 + } + }, + + listeners: { + 'lang-updated': 'langUpdated' + }, + + getArray: function (count) { + var a = []; + for (var i = 0; i < count; i++) { + a.push(i); + } + return a; + }, + + domChanged: function (e) { + var nodes = dom(this.root).querySelectorAll('item-element'); + if (this.lang === 'en' && this.effectiveLang === '') { + this.effectiveLang = 'en'; + } + //console.log('multiple-element: dom-change count = ' + nodes.length + ' lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + if (nodes.length === this.count && + (this.lang === this.effectiveLang || + (this.effectiveLang === '' && this.lang ==='en'))) { + Array.prototype.forEach.call(nodes, function (node) { + this.$.save.appendChild(node); + }.bind(this)); + //console.log('multiple-element: local-dom-ready'); + this.async(function () { this.fire('local-dom-ready'); }, 500); + } + }, + + langUpdated: function (e) { + var target = dom(e).rootTarget; + var lang = target.lang === '' ? 'en' : target.lang; + this.itemLang = this.itemLang || {}; + if (target.tagName.toLowerCase() === 'item-element') { + //console.log('item-element: lang-updated lang = ' + target.lang); + this.itemLang[lang] = this.itemLang[lang] || 0; + this.itemLang[lang]++; + } + //console.log('multiple-element: ' + target.is + ' ' + + // 'lang-updated lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang + + // ' itemLang[' + this.lang + '] = ' + this.itemLang[this.lang]); + if (this.itemLang[this.lang] === this.count) { + //console.log('count reached for ' + this.lang); + this.$.items.render(); + } + return false; + } + }); + } + break; +} diff --git a/test/preprocess3/multiple-case/multiple-element.json b/test/preprocess3/multiple-case/multiple-element.json new file mode 100644 index 00000000..ce3f5d10 --- /dev/null +++ b/test/preprocess3/multiple-case/multiple-element.json @@ -0,0 +1,4 @@ +{ + "meta": {}, + "model": {} +} \ No newline at end of file diff --git a/test/preprocess3/no-persist-test-imports.js b/test/preprocess3/no-persist-test-imports.js new file mode 100644 index 00000000..6da6b750 --- /dev/null +++ b/test/preprocess3/no-persist-test-imports.js @@ -0,0 +1,22 @@ +import './fake-server.js'; +import './test-runner.js'; +import '../../i18n-element.js'; +import '../../define-element.js'; +import '../../i18n-dom-bind.js'; +import './preference/preference-element.js'; +import './no-persist-test-suites.js'; + +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +/* + + +*/ +/* + FIXME(polymer-modulizer): the above comments were extracted + from HTML and may be out of place here. Review them and + then delete this comment! +*/ +; diff --git a/test/preprocess3/no-persist-test-suites.js b/test/preprocess3/no-persist-test-suites.js new file mode 100644 index 00000000..1bdc7ec4 --- /dev/null +++ b/test/preprocess3/no-persist-test-suites.js @@ -0,0 +1,64 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import './test-runner.js'; +suite('I18nElement with ' + + (window.location.href.indexOf('?dom=Shadow') >= 0 ? 'Shadow DOM' : 'Shady DOM') + + (' in ' + syntax + ' syntax'), + function () { + + var lang0 = ''; + var lang1 = 'en'; + var lang2 = 'fr'; + var lang3 = 'ja'; + var lang4 = 'fr-CA'; + var lang5 = 'zh-Hans-CN'; + var lang6 = 'ru'; + var lang7 = 'zh-yue-Hans-CN'; + var lang8 = 'zh-CN'; + var lang9 = 'zh-TW'; + var lang10 = 'zh-Hans-CN-x-Linux'; + var navigatorLanguage = navigator.language || navigator.browserLanguage; + var isNavigatorLanguageEn = navigatorLanguage.match(/^en/); + + var suites = [ + s('preference', null, { + fixture: 'preference-element-fixture', + fixtureModel: undefined, + assign: undefined, + lang: isNavigatorLanguageEn ? lang1 : lang0, + effectiveLang: isNavigatorLanguageEn ? lang1 : lang0, + templateDefaultLang: lang1, + observeHtmlLang: true, + event: 'local-dom-ready', + text: { model: {} }, + model: {}, + localDOM: [ + (function F(){}).name ? { select: 'span#oldLang', 'lang.raw': navigatorLanguage } : { select: 'span#oldLang' } + ], + lightDOM: undefined + }) + ]; + + suitesRunner(suites); + + suite('change persist', function () { + test('persist true', function (done) { + var p = document.querySelector('i18n-preference'); + p.persist = true; + assert.equal(p.persist, true, 'persist is true'); + done(); + }); + }); + + suite('detech preference', function () { + test('detach', function (done) { + var p = document.querySelector('i18n-preference'); + p.parentNode.removeChild(p); + assert.equal(p.persist, true, 'persist is true'); + done(); + }); + }); + +}); diff --git a/test/preprocess3/no-persist-test.html b/test/preprocess3/no-persist-test.html new file mode 100644 index 00000000..e4504460 --- /dev/null +++ b/test/preprocess3/no-persist-test.html @@ -0,0 +1,39 @@ + + + + + + + + + + + +

+ + + + + + + + + + \ No newline at end of file diff --git a/test/preprocess3/plural-gender-element/locales/plural-gender-element.fr.json b/test/preprocess3/plural-gender-element/locales/plural-gender-element.fr.json new file mode 100755 index 00000000..407b656d --- /dev/null +++ b/test/preprocess3/plural-gender-element/locales/plural-gender-element.fr.json @@ -0,0 +1,27 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "compound-format-text": [ + { + "0": "fr You ({3}) gave no gifts.", + "1": { + "male": "fr You ({3}) gave him ({4}) {5}.", + "female": "fr You ({3}) gave her ({4}) {5}.", + "other": "fr You ({3}) gave them ({4}) {5}." + }, + "one": { + "male": "fr You ({3}) gave him ({4}) and one other person {5}.", + "female": "fr You ({3}) gave her ({4}) and one other person {5}.", + "other": "fr You ({3}) gave them ({4}) and one other person {5}." + }, + "other": "fr You ({3}) gave them ({4}) and {1} other people gifts." + }, + "{{recipients.length - 1}}", + "{{recipients.0.gender}}", + "{{sender.name}}", + "{{recipients.0.name}}", + "fr a gift" + ] +} \ No newline at end of file diff --git a/test/preprocess3/plural-gender-element/plural-gender-element.js b/test/preprocess3/plural-gender-element/plural-gender-element.js new file mode 100644 index 00000000..995fc01b --- /dev/null +++ b/test/preprocess3/plural-gender-element/plural-gender-element.js @@ -0,0 +1,364 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class PluralGenderElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +

+ + {{serialize(text.compound-format-text.0)}} + {{recipients.length}} + {{recipients.0.gender}} + {{sender.name}} + {{recipients.0.name}} + {{text.compound-format-text.5}} + +

+ +`); + } + + static get is() { return 'plural-gender-element' } + + static get properties () { + return { + sender: { + type: Object + }, + recipients: { + type: Array + } + } + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated(e) { + console.log('plural-gender-element lang-updated lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + if (this.renderedEffectiveLang === this.effectiveLang || + (this.renderedEffectiveLang === '' && this.effectiveLang === 'en')) { + this.fire('local-dom-ready'); + } + } + + _rendered() { + console.log('plural-gender-element rendered lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + if (this.lang === this.effectiveLang) { + this.fire('local-dom-ready'); + } + else { + this.renderedEffectiveLang = this.effectiveLang; + } + } + } + customElements.define(PluralGenderElement.is, PluralGenderElement); + } + break; +case 'base-element': + { + class PluralGenderElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +

+ + {{serialize(text.compound-format-text.0)}} + {{recipients.length}} + {{recipients.0.gender}} + {{sender.name}} + {{recipients.0.name}} + {{text.compound-format-text.5}} + +

+ +`); + } + + static get is() { return 'plural-gender-element' } + + static get properties () { + return { + sender: { + type: Object + }, + recipients: { + type: Array + } + } + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated(e) { + console.log('plural-gender-element lang-updated lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + if (this.renderedEffectiveLang === this.effectiveLang || + (this.renderedEffectiveLang === '' && this.effectiveLang === 'en')) { + this.fire('local-dom-ready'); + } + } + + _rendered() { + console.log('plural-gender-element rendered lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + if (this.lang === this.effectiveLang) { + this.fire('local-dom-ready'); + } + else { + this.renderedEffectiveLang = this.effectiveLang; + } + } + } + customElements.define(PluralGenderElement.is, PluralGenderElement); + } + break; +case 'thin': + { + Define = class PluralGenderElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + static get properties () { + return { + sender: { + type: Object + }, + recipients: { + type: Array + } + } + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated(e) { + console.log('plural-gender-element lang-updated lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + if (this.renderedEffectiveLang === this.effectiveLang || + (this.renderedEffectiveLang === '' && this.effectiveLang === 'en')) { + this.fire('local-dom-ready'); + } + } + + _rendered() { + console.log('plural-gender-element rendered lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + if (this.lang === this.effectiveLang) { + this.fire('local-dom-ready'); + } + else { + this.renderedEffectiveLang = this.effectiveLang; + } + } + }; + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +

+ + {{serialize(text.compound-format-text.0)}} + {{recipients.length}} + {{recipients.0.gender}} + {{sender.name}} + {{recipients.0.name}} + {{text.compound-format-text.5}} + +

+ +`), + + is: 'plural-gender-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + properties: { + sender: { + type: Object + }, + recipients: { + type: Array + } + }, + + listeners: { + 'lang-updated': '_langUpdated' + }, + + _langUpdated: function (e) { + console.log('plural-gender-element lang-updated lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + if (this.renderedEffectiveLang === this.effectiveLang || + (this.renderedEffectiveLang === '' && this.effectiveLang === 'en')) { + this.fire('local-dom-ready'); + } + }, + + _rendered: function () { + console.log('plural-gender-element rendered lang = ' + this.lang + ' effectiveLang = ' + this.effectiveLang); + if (this.lang === this.effectiveLang) { + this.fire('local-dom-ready'); + } + else { + this.renderedEffectiveLang = this.effectiveLang; + } + } + }); + } + break; +} diff --git a/test/preprocess3/plural-gender-element/plural-gender-element.json b/test/preprocess3/plural-gender-element/plural-gender-element.json new file mode 100644 index 00000000..c8cf341f --- /dev/null +++ b/test/preprocess3/plural-gender-element/plural-gender-element.json @@ -0,0 +1,25 @@ +{ + "meta": {}, + "model": {}, + "compound-format-text": [ + { + "0": "You ({3}) gave no gifts.", + "1": { + "male": "You ({3}) gave him ({4}) {5}.", + "female": "You ({3}) gave her ({4}) {5}.", + "other": "You ({3}) gave them ({4}) {5}." + }, + "one": { + "male": "You ({3}) gave him ({4}) and one other person {5}.", + "female": "You ({3}) gave her ({4}) and one other person {5}.", + "other": "You ({3}) gave them ({4}) and one other person {5}." + }, + "other": "You ({3}) gave them ({4}) and {1} other people gifts." + }, + "{{recipients.length - 1}}", + "{{recipients.0.gender}}", + "{{sender.name}}", + "{{recipients.0.name}}", + "a gift" + ] +} \ No newline at end of file diff --git a/test/preprocess3/preference-test-imports.js b/test/preprocess3/preference-test-imports.js new file mode 100644 index 00000000..a645e634 --- /dev/null +++ b/test/preprocess3/preference-test-imports.js @@ -0,0 +1,22 @@ +import './fake-server.js'; +import './test-runner.js'; +import '../../i18n-element.js'; +import '../../define-element.js'; +import '../../i18n-dom-bind.js'; +import './preference/preference-element.js'; +import './preference-test-suites.js'; + +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +/* + + +*/ +/* + FIXME(polymer-modulizer): the above comments were extracted + from HTML and may be out of place here. Review them and + then delete this comment! +*/ +; diff --git a/test/preprocess3/preference-test-suites.js b/test/preprocess3/preference-test-suites.js new file mode 100644 index 00000000..a9e44be1 --- /dev/null +++ b/test/preprocess3/preference-test-suites.js @@ -0,0 +1,46 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import './test-runner.js'; +suite('I18nElement with ' + + (window.location.href.indexOf('?dom=Shadow') >= 0 ? 'Shadow DOM' : 'Shady DOM') + + (' in ' + syntax + ' syntax'), + function () { + + var lang0 = ''; + var lang1 = 'en'; + var lang2 = 'fr'; + var lang3 = 'ja'; + var lang4 = 'fr-CA'; + var lang5 = 'zh-Hans-CN'; + var lang6 = 'ru'; + var lang7 = 'zh-yue-Hans-CN'; + var lang8 = 'zh-CN'; + var lang9 = 'zh-TW'; + var lang10 = 'zh-Hans-CN-x-Linux'; + var navigatorLanguage = navigator.language || navigator.browserLanguage; + var isNavigatorLanguageEn = navigatorLanguage.match(/^en/); + + var suites = [ + s('preference', null, { + fixture: 'preference-element-fixture', + fixtureModel: undefined, + assign: undefined, + lang: isNavigatorLanguageEn ? lang1 : lang0, + effectiveLang: isNavigatorLanguageEn ? lang1 : lang0, + templateDefaultLang: lang1, + observeHtmlLang: true, + event: 'local-dom-ready', + text: { model: {} }, + model: {}, + localDOM: [ + (function F(){}).name ? { select: 'span#oldLang', 'lang.raw': navigatorLanguage } : { select: 'span#oldLang' } + ], + lightDOM: undefined + }) + ]; + + suitesRunner(suites); + +}); diff --git a/test/preprocess3/preference-test.html b/test/preprocess3/preference-test.html new file mode 100644 index 00000000..ee3f08e7 --- /dev/null +++ b/test/preprocess3/preference-test.html @@ -0,0 +1,33 @@ + + + + + + + + + + + +

+ + + + + + + + + \ No newline at end of file diff --git a/test/preprocess3/preference/preference-element.js b/test/preprocess3/preference/preference-element.js new file mode 100644 index 00000000..dad6aa17 --- /dev/null +++ b/test/preprocess3/preference/preference-element.js @@ -0,0 +1,173 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class PreferenceElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + + +`); + } + + static get is() { return 'preference-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + console.log(e.detail); + console.log('navigator.language = ' + navigator.language); + if (!e.detail.lastLang || e.detail.lastLang === 'en' || e.detail.lastLang === 'en-US') { + this.$.oldLang.lang = e.detail.oldLang; + this.fire('local-dom-ready'); + } + } + } + } + customElements.define(PreferenceElement.is, PreferenceElement); + } + break; +case 'base-element': + { + class PreferenceElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + + +`); + } + + static get is() { return 'preference-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + console.log(e.detail); + console.log('navigator.language = ' + navigator.language); + if (!e.detail.lastLang || e.detail.lastLang === 'en') { + this.$.oldLang.lang = e.detail.oldLang; + this.fire('local-dom-ready'); + } + } + } + } + customElements.define(PreferenceElement.is, PreferenceElement); + } + break; +case 'thin': + { + Define = class PreferenceElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + console.log(e.detail); + console.log('navigator.language = ' + navigator.language); + if (!e.detail.lastLang || e.detail.lastLang === 'en') { + this.$.oldLang.lang = e.detail.oldLang; + this.fire('local-dom-ready'); + } + } + } + }; + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + + +`), + + is: 'preference-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + listeners: { + 'lang-updated': '_langUpdated' + }, + + _langUpdated: function (e) { + if (dom(e).rootTarget === this) { + console.log(e.detail); + console.log('navigator.language = ' + navigator.language); + if (!e.detail.lastLang || e.detail.lastLang === 'en') { + this.$.oldLang.lang = e.detail.oldLang; + this.fire('local-dom-ready'); + } + } + } + }); + } + break; +} diff --git a/test/preprocess3/preference/preference-element.json b/test/preprocess3/preference/preference-element.json new file mode 100644 index 00000000..ce3f5d10 --- /dev/null +++ b/test/preprocess3/preference/preference-element.json @@ -0,0 +1,4 @@ +{ + "meta": {}, + "model": {} +} \ No newline at end of file diff --git a/test/preprocess3/simple-attribute-dom-bind.json b/test/preprocess3/simple-attribute-dom-bind.json new file mode 100644 index 00000000..6844e568 --- /dev/null +++ b/test/preprocess3/simple-attribute-dom-bind.json @@ -0,0 +1,144 @@ +{ + "meta": {}, + "model": { + "standard-input": { + "placeholder": "standard HTML5 attribute" + }, + "outer-div:input_2": { + "placeholder": "standard HTML5 attribute without id" + }, + "paper-input-element": { + "label": "paper-input label", + "error-message": "paper-input error message", + "placeholder": "paper-input placeholder" + }, + "outer-div:paper-input_4": { + "label": "paper-input label without id", + "error-message": "paper-input error message without id", + "placeholder": "paper-input placeholder without id" + }, + "pie-chart": { + "options": { + "title": "Distribution of days in 2001H1" + }, + "cols": [ + { + "label": "Month", + "type": "string" + }, + { + "label": "Days", + "type": "number" + } + ], + "rows": [ + [ + "Jan", + 31 + ], + [ + "Feb", + 28 + ], + [ + "Mar", + 31 + ], + [ + "Apr", + 30 + ], + [ + "May", + 31 + ], + [ + "Jun", + 30 + ] + ] + }, + "column-chart": { + "options": { + "title": "Inventory" + }, + "data": [ + [ + "Year", + "Things", + "Stuff" + ], + [ + "2004", + 1000, + 400 + ], + [ + "2005", + 1170, + 460 + ], + [ + "2006", + 660, + 1120 + ], + [ + "2007", + 1030, + 540 + ] + ] + }, + "custom-attr": { + "custom-text-attr1": "custom text attribute 1", + "custom-text-attr2": "custom text attribute 2", + "custom-text-attr3": "custom text attribute 3" + }, + "selective-attr": { + "custom-text-attr4": [ + "{1} custom-text-attr4 attribute with param {2} and param {3} {4}", + "{{text.ordinary-div}}", + "{{text.ordinary-div}}", + "[[text.ordinary-div]]", + "{{text.ordinary-div}}" + ], + "custom-text-attr5": [ + "[[text.ordinary-div]]", + " custom-text-attr5 attribute with param ", + "{{or('',text.ordinary-div)}}", + " and param ", + "[[text.ordinary-div]]" + ], + "i18n-target": [ + "i18n-target attribute with param {1} and param {2}", + "{{text.ordinary-div}}", + "[[text.ordinary-div]]" + ], + "i18n-target2": [ + "i18n-target2 attribute with param ", + "{{or('',text.ordinary-div)}}", + " and param ", + "[[text.ordinary-div]]" + ] + }, + "selective-attr2": { + "i18n-target": "i18n-target attribute 2" + }, + "selective-attr3": { + "i18n-target6": "i18n-target6 attribute 2" + }, + "selective-attr4": { + "i18n-target6": "i18n-target6 attribute 3" + }, + "json-data-id": { + "attr1": "this attr1 is extracted", + "i18n-target-attr": "this attribute is also extracted" + }, + "template_2:json-data_1": { + "attr1": "this attr1 without id is extracted", + "i18n-target-attr": "this attribute without id is also extracted" + } + }, + "ordinary-div": "text 1" +} \ No newline at end of file diff --git a/test/preprocess3/simple-attribute-element/locales/simple-attribute-element.fr.json b/test/preprocess3/simple-attribute-element/locales/simple-attribute-element.fr.json new file mode 100755 index 00000000..4161d2ad --- /dev/null +++ b/test/preprocess3/simple-attribute-element/locales/simple-attribute-element.fr.json @@ -0,0 +1,146 @@ +{ + "meta": { + "todo": [] + }, + "model": { + "standard-input": { + "placeholder": "fr standard HTML5 attribute" + }, + "outer-div:input_2": { + "placeholder": "fr standard HTML5 attribute without id" + }, + "paper-input-element": { + "label": "fr paper-input label", + "error-message": "fr paper-input error message", + "placeholder": "fr paper-input placeholder" + }, + "outer-div:paper-input_4": { + "label": "fr paper-input label without id", + "error-message": "fr paper-input error message without id", + "placeholder": "fr paper-input placeholder without id" + }, + "pie-chart": { + "options": { + "title": "fr Distribution of days in 2001H1" + }, + "cols": [ + { + "label": "fr Month", + "type": "string" + }, + { + "label": "fr Days", + "type": "number" + } + ], + "rows": [ + [ + "fr Jan", + 31 + ], + [ + "fr Feb", + 28 + ], + [ + "fr Mar", + 31 + ], + [ + "fr Apr", + 30 + ], + [ + "fr May", + 31 + ], + [ + "fr Jun", + 30 + ] + ] + }, + "column-chart": { + "options": { + "title": "fr Inventory" + }, + "data": [ + [ + "fr Year", + "fr Things", + "fr Stuff" + ], + [ + "2004", + 1000, + 400 + ], + [ + "2005", + 1170, + 460 + ], + [ + "2006", + 660, + 1120 + ], + [ + "2007", + 1030, + 540 + ] + ] + }, + "custom-attr": { + "custom-text-attr1": "fr custom text attribute 1", + "custom-text-attr2": "fr custom text attribute 2", + "custom-text-attr3": "fr custom text attribute 3" + }, + "selective-attr": { + "custom-text-attr4": [ + "fr {1} custom-text-attr4 attribute with param {2} and param {3} {4}", + "{{text.ordinary-div}}", + "{{text.ordinary-div}}", + "[[text.ordinary-div]]", + "{{text.ordinary-div}}" + ], + "custom-text-attr5": [ + "[[text.ordinary-div]]", + " fr custom-text-attr5 attribute with param ", + "{{or('',text.ordinary-div)}}", + " fr and param ", + "[[text.ordinary-div]]" + ], + "i18n-target": [ + "fr i18n-target attribute with param {1} and param {2}", + "{{text.ordinary-div}}", + "[[text.ordinary-div]]" + ], + "i18n-target2": [ + "fr i18n-target2 attribute with param ", + "{{or('',text.ordinary-div)}}", + " fr and param ", + "[[text.ordinary-div]]" + ] + }, + "selective-attr2": { + "i18n-target": "fr i18n-target attribute 2" + }, + "selective-attr3": { + "i18n-target6": "fr i18n-target6 attribute 2" + }, + "selective-attr4": { + "i18n-target6": "fr i18n-target6 attribute 3" + }, + "json-data-id": { + "attr1": "fr this attr1 is extracted", + "i18n-target-attr": "fr this attribute is also extracted" + }, + "template_2:json-data_1": { + "attr1": "fr this attr1 without id is extracted", + "i18n-target-attr": "fr this attribute without id is also extracted" + } + }, + "ordinary-div": "fr text 1" +} \ No newline at end of file diff --git a/test/preprocess3/simple-attribute-element/locales/text-attribute-element.fr.json b/test/preprocess3/simple-attribute-element/locales/text-attribute-element.fr.json new file mode 100644 index 00000000..7d70a535 --- /dev/null +++ b/test/preprocess3/simple-attribute-element/locales/text-attribute-element.fr.json @@ -0,0 +1,7 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "span_4": "fr text" +} \ No newline at end of file diff --git a/test/preprocess3/simple-attribute-element/simple-attribute-element.js b/test/preprocess3/simple-attribute-element/simple-attribute-element.js new file mode 100644 index 00000000..ace99393 --- /dev/null +++ b/test/preprocess3/simple-attribute-element/simple-attribute-element.js @@ -0,0 +1,957 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +/* */ +/* */ +/* + FIXME(polymer-modulizer): the above comments were extracted + from HTML and may be out of place here. Review them and + then delete this comment! +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import './text-attribute-element.js'; +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class SimpleAttributeElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + +
+
{{text.ordinary-div}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{model.json-data-id.attr1}} + {{model.json-data-id.i18n-target-attr}} + {{model.template_2:json-data_1.attr1}} + {{model.template_2:json-data_1.i18n-target-attr}} + +
+ + +`); + } + + static get is() { return 'simple-attribute-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + connectedCallback() { + super.connectedCallback(); + this._intervalId = window.setInterval(this._checkChartStatus.bind(this), 1000); + setTimeout(function () { + this.isPieChartRendered = true; + this.isColumnChartRendered = true; + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); // TODO: this is an ad-hoc solution + }.bind(this), 200); + } + + disconnectedCallback() { + super.disconnectedCallback(); + } + + _checkChartStatus() { + var pieChartInnerHtml = this.$['pie-chart'].$.chartdiv.innerHTML; + var columnChartInnerHtml = this.$['column-chart'].$.chartdiv.innerHTML; + var notLoaded = false; + if (pieChartInnerHtml === 'Undefined chart type') { + this.isPieChartRendered = true; // google api to blame; this is not responsible + } + if (columnChartInnerHtml === 'Undefined chart type') { + this.isColumnChartRendered = true; // google api to blame; this is not responsible + } + if (this.isPieChartRendered && this.isColumnChartRendered) { + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); + } + } + + _langUpdated(e) { + console.log('_langUpdated'); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + + _pieChartRendered() { + this.isPieChartRendered = true; + if (this.isPieChartRendered && this.isColumnChartRendered) { + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); + } + } + + _columnChartRendered() { + this.isColumnChartRendered = true; + if (this.isPieChartRendered && this.isColumnChartRendered) { + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); + } + } + } + customElements.define(SimpleAttributeElement.is, SimpleAttributeElement); + } + break; +case 'base-element': + { + class SimpleAttributeElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + +
+
{{text.ordinary-div}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{model.json-data-id.attr1}} + {{model.json-data-id.i18n-target-attr}} + {{model.template_2:json-data_1.attr1}} + {{model.template_2:json-data_1.i18n-target-attr}} + +
+ + +`); + } + + static get is() { return 'simple-attribute-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + connectedCallback() { + super.connectedCallback(); + this._intervalId = window.setInterval(this._checkChartStatus.bind(this), 1000); + setTimeout(function () { + this.isPieChartRendered = true; + this.isColumnChartRendered = true; + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); // TODO: this is an ad-hoc solution + }.bind(this), 200); + } + + disconnectedCallback() { + super.disconnectedCallback(); + } + + _checkChartStatus() { + var pieChartInnerHtml = this.$['pie-chart'].$.chartdiv.innerHTML; + var columnChartInnerHtml = this.$['column-chart'].$.chartdiv.innerHTML; + var notLoaded = false; + if (pieChartInnerHtml === 'Undefined chart type') { + this.isPieChartRendered = true; // google api to blame; this is not responsible + } + if (columnChartInnerHtml === 'Undefined chart type') { + this.isColumnChartRendered = true; // google api to blame; this is not responsible + } + if (this.isPieChartRendered && this.isColumnChartRendered) { + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); + } + } + + _langUpdated(e) { + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + + _pieChartRendered() { + this.isPieChartRendered = true; + if (this.isPieChartRendered && this.isColumnChartRendered) { + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); + } + } + + _columnChartRendered() { + this.isColumnChartRendered = true; + if (this.isPieChartRendered && this.isColumnChartRendered) { + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); + } + } + } + customElements.define(SimpleAttributeElement.is, SimpleAttributeElement); + } + break; +case 'thin': + { + Define = class SimpleAttributeElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + connectedCallback() { + super.connectedCallback(); + this._intervalId = window.setInterval(this._checkChartStatus.bind(this), 1000); + setTimeout(function () { + this.isPieChartRendered = true; + this.isColumnChartRendered = true; + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); // TODO: this is an ad-hoc solution + }.bind(this), 200); + } + + disconnectedCallback() { + super.disconnectedCallback(); + } + + _checkChartStatus() { + var pieChartInnerHtml = this.$['pie-chart'].$.chartdiv.innerHTML; + var columnChartInnerHtml = this.$['column-chart'].$.chartdiv.innerHTML; + var notLoaded = false; + if (pieChartInnerHtml === 'Undefined chart type') { + this.isPieChartRendered = true; // google api to blame; this is not responsible + } + if (columnChartInnerHtml === 'Undefined chart type') { + this.isColumnChartRendered = true; // google api to blame; this is not responsible + } + if (this.isPieChartRendered && this.isColumnChartRendered) { + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); + } + } + + _langUpdated(e) { + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + + _pieChartRendered() { + this.isPieChartRendered = true; + if (this.isPieChartRendered && this.isColumnChartRendered) { + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); + } + } + + _columnChartRendered() { + this.isColumnChartRendered = true; + if (this.isPieChartRendered && this.isColumnChartRendered) { + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); + } + } + } + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + +
+
{{text.ordinary-div}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{model.json-data-id.attr1}} + {{model.json-data-id.i18n-target-attr}} + {{model.template_2:json-data_1.attr1}} + {{model.template_2:json-data_1.i18n-target-attr}} + +
+ + +`), + + is: 'simple-attribute-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + listeners: { + 'lang-updated': '_langUpdated', + 'pie-chart.google-chart-render': '_pieChartRendered', + 'column-chart.google-chart-render': '_columnChartRendered' + }, + + ready: function () { + //this.observeHtmlLang = false; + }, + + attached: function () { + this._intervalId = window.setInterval(this._checkChartStatus.bind(this), 1000); + setTimeout(function () { + this.isPieChartRendered = true; + this.isColumnChartRendered = true; + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); // TODO: this is an ad-hoc solution + }.bind(this), 200); + }, + + _checkChartStatus: function () { + var pieChartInnerHtml = this.$['pie-chart'].$.chartdiv.innerHTML; + var columnChartInnerHtml = this.$['column-chart'].$.chartdiv.innerHTML; + var notLoaded = false; + if (pieChartInnerHtml === 'Undefined chart type') { + this.isPieChartRendered = true; // google api to blame; this is not responsible + } + if (columnChartInnerHtml === 'Undefined chart type') { + this.isColumnChartRendered = true; // google api to blame; this is not responsible + } + if (this.isPieChartRendered && this.isColumnChartRendered) { + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); + } + }, + + _langUpdated: function (e) { + if (dom(e).rootTarget === this) { + this.model = deepcopy(this.text.model); + } + }, + + _pieChartRendered: function () { + this.isPieChartRendered = true; + if (this.isPieChartRendered && this.isColumnChartRendered) { + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); + } + }, + + _columnChartRendered: function () { + this.isColumnChartRendered = true; + if (this.isPieChartRendered && this.isColumnChartRendered) { + window.clearInterval(this._intervalId); + this.fire('local-dom-ready'); + } + } + }); + } + break; +} diff --git a/test/preprocess3/simple-attribute-element/simple-attribute-element.json b/test/preprocess3/simple-attribute-element/simple-attribute-element.json new file mode 100644 index 00000000..6844e568 --- /dev/null +++ b/test/preprocess3/simple-attribute-element/simple-attribute-element.json @@ -0,0 +1,144 @@ +{ + "meta": {}, + "model": { + "standard-input": { + "placeholder": "standard HTML5 attribute" + }, + "outer-div:input_2": { + "placeholder": "standard HTML5 attribute without id" + }, + "paper-input-element": { + "label": "paper-input label", + "error-message": "paper-input error message", + "placeholder": "paper-input placeholder" + }, + "outer-div:paper-input_4": { + "label": "paper-input label without id", + "error-message": "paper-input error message without id", + "placeholder": "paper-input placeholder without id" + }, + "pie-chart": { + "options": { + "title": "Distribution of days in 2001H1" + }, + "cols": [ + { + "label": "Month", + "type": "string" + }, + { + "label": "Days", + "type": "number" + } + ], + "rows": [ + [ + "Jan", + 31 + ], + [ + "Feb", + 28 + ], + [ + "Mar", + 31 + ], + [ + "Apr", + 30 + ], + [ + "May", + 31 + ], + [ + "Jun", + 30 + ] + ] + }, + "column-chart": { + "options": { + "title": "Inventory" + }, + "data": [ + [ + "Year", + "Things", + "Stuff" + ], + [ + "2004", + 1000, + 400 + ], + [ + "2005", + 1170, + 460 + ], + [ + "2006", + 660, + 1120 + ], + [ + "2007", + 1030, + 540 + ] + ] + }, + "custom-attr": { + "custom-text-attr1": "custom text attribute 1", + "custom-text-attr2": "custom text attribute 2", + "custom-text-attr3": "custom text attribute 3" + }, + "selective-attr": { + "custom-text-attr4": [ + "{1} custom-text-attr4 attribute with param {2} and param {3} {4}", + "{{text.ordinary-div}}", + "{{text.ordinary-div}}", + "[[text.ordinary-div]]", + "{{text.ordinary-div}}" + ], + "custom-text-attr5": [ + "[[text.ordinary-div]]", + " custom-text-attr5 attribute with param ", + "{{or('',text.ordinary-div)}}", + " and param ", + "[[text.ordinary-div]]" + ], + "i18n-target": [ + "i18n-target attribute with param {1} and param {2}", + "{{text.ordinary-div}}", + "[[text.ordinary-div]]" + ], + "i18n-target2": [ + "i18n-target2 attribute with param ", + "{{or('',text.ordinary-div)}}", + " and param ", + "[[text.ordinary-div]]" + ] + }, + "selective-attr2": { + "i18n-target": "i18n-target attribute 2" + }, + "selective-attr3": { + "i18n-target6": "i18n-target6 attribute 2" + }, + "selective-attr4": { + "i18n-target6": "i18n-target6 attribute 3" + }, + "json-data-id": { + "attr1": "this attr1 is extracted", + "i18n-target-attr": "this attribute is also extracted" + }, + "template_2:json-data_1": { + "attr1": "this attr1 without id is extracted", + "i18n-target-attr": "this attribute without id is also extracted" + } + }, + "ordinary-div": "text 1" +} \ No newline at end of file diff --git a/test/preprocess3/simple-attribute-element/text-attribute-element.js b/test/preprocess3/simple-attribute-element/text-attribute-element.js new file mode 100644 index 00000000..8d77c828 --- /dev/null +++ b/test/preprocess3/simple-attribute-element/text-attribute-element.js @@ -0,0 +1,321 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ` + + +`; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class TextAttributeElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + {{customTextAttr1}} + {{customTextAttr2}} + {{customTextAttr3}} + {{outOfScopeAttr}} + {{text.span_4}} + +`); + } + + static get is() { return 'text-attribute-element'; } + + static get properties () { + return { + customTextAttr1: { + type: String, + reflectToAttribute: true + }, + customTextAttr2: { + type: String, + reflectToAttribute: true + }, + customTextAttr3: { + type: String, + reflectToAttribute: true + }, + outOfScopeAttr: { + type: String, + reflectToAttribute: true + }, + i18nTarget: { + type: String + }, + i18nTarget2: { + type: String + } + }; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated () { + this.model = deepcopy(this.text.model); + } + } + customElements.define(TextAttributeElement.is, TextAttributeElement); + } + break; +case 'base-element': + { + class TextAttributeElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + {{customTextAttr1}} + {{customTextAttr2}} + {{customTextAttr3}} + {{outOfScopeAttr}} + {{text.span_4}} + +`); + } + + static get is() { return 'text-attribute-element'; } + + static get properties () { + return { + customTextAttr1: { + type: String, + reflectToAttribute: true + }, + customTextAttr2: { + type: String, + reflectToAttribute: true + }, + customTextAttr3: { + type: String, + reflectToAttribute: true + }, + outOfScopeAttr: { + type: String, + reflectToAttribute: true + }, + i18nTarget: { + type: String + }, + i18nTarget2: { + type: String + } + }; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated () { + this.model = deepcopy(this.text.model); + } + } + customElements.define(TextAttributeElement.is, TextAttributeElement); + } + break; +case 'thin': + { + Define = class TextAttributeElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + static get properties () { + return { + customTextAttr1: { + type: String, + reflectToAttribute: true + }, + customTextAttr2: { + type: String, + reflectToAttribute: true + }, + customTextAttr3: { + type: String, + reflectToAttribute: true + }, + outOfScopeAttr: { + type: String, + reflectToAttribute: true + }, + i18nTarget: { + type: String + }, + i18nTarget2: { + type: String + } + }; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated () { + this.model = deepcopy(this.text.model); + } + }; + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` + {{customTextAttr1}} + {{customTextAttr2}} + {{customTextAttr3}} + {{outOfScopeAttr}} + {{text.span_4}} + +`), + + is: 'text-attribute-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + properties: { + customTextAttr1: { + type: String, + reflectToAttribute: true + }, + customTextAttr2: { + type: String, + reflectToAttribute: true + }, + customTextAttr3: { + type: String, + reflectToAttribute: true + }, + outOfScopeAttr: { + type: String, + reflectToAttribute: true + }, + i18nTarget: { + type: String + }, + i18nTarget2: { + type: String + } + }, + + listeners: { + 'lang-updated': '_langUpdated' + }, + + ready: function () { + //this.observeHtmlLang = false; + }, + + attached: function () { + }, + + _langUpdated: function () { + this.model = deepcopy(this.text.model); + } + }); + } + break; +} diff --git a/test/preprocess3/simple-attribute-element/text-attribute-element.json b/test/preprocess3/simple-attribute-element/text-attribute-element.json new file mode 100644 index 00000000..2715342d --- /dev/null +++ b/test/preprocess3/simple-attribute-element/text-attribute-element.json @@ -0,0 +1,5 @@ +{ + "meta": {}, + "model": {}, + "span_4": "text" +} \ No newline at end of file diff --git a/test/preprocess3/simple-text-dom-bind.json b/test/preprocess3/simple-text-dom-bind.json new file mode 100644 index 00000000..f9b2ccf7 --- /dev/null +++ b/test/preprocess3/simple-text-dom-bind.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "model": {}, + "text": " outermost text at the beginning ", + "h1_3": "outermost header 1", + "text_4": " outermost text in the middle ", + "span_5": "simple text without id", + "span_6": "simple text without id 2", + "label-1": "simple text with id", + "label-2": "simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "simple text within div", + "toplevel-div:span_1": "simple text within div 2", + "third-level-div": "great grandchild text within div", + "second-level-div:div_1": "great grandchild text within div without id", + "div_12:ul:li": "line item without id 1", + "div_12:ul:li_1": "line item without id 2", + "div_12:ul:li_2": "line item without id 3", + "line-items:li": "line item with id 1", + "line-items:li_1": "line item with id 2", + "line-items:li_2": "line item with id 3", + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "parameters", + "" + ], + "paragraph": [ + "A paragraph with {1} is converted to {2}.", + "id", + "" + ], + "text_15": " outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/simple-text-element/locales/simple-text-element.fr.json b/test/preprocess3/simple-text-element/locales/simple-text-element.fr.json new file mode 100755 index 00000000..d993e702 --- /dev/null +++ b/test/preprocess3/simple-text-element/locales/simple-text-element.fr.json @@ -0,0 +1,43 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "text": " fr outermost text at the beginning ", + "h1_3": "fr outermost header 1", + "text_4": " fr outermost text in the middle ", + "span_5": "fr simple text without id", + "span_6": "fr simple text without id 2", + "label-1": "fr simple text with id", + "label-2": "fr simple text with id 2", + "div_9:span": "fr simple text within div", + "div_9:span_1": "fr simple text within div 2", + "div_9:div_2:div": "fr great grandchild text within div", + "div_10:text": " fr simple text as the first element in div ", + "div_10:span_1": "fr simple text within div", + "div_10:text_2": " fr simple text in the middle of div ", + "div_10:span_3": "fr simple text within div 2", + "div_10:div_4:div": "fr great grandchild text within div", + "div_10:text_5": " fr simple text at the last element in div ", + "toplevel-div:span": "fr simple text within div", + "toplevel-div:span_1": "fr simple text within div 2", + "third-level-div": "fr great grandchild text within div", + "second-level-div:div_1": "fr great grandchild text within div without id", + "div_12:ul:li": "fr line item without id 1", + "div_12:ul:li_1": "fr line item without id 2", + "div_12:ul:li_2": "fr line item without id 3", + "line-items:li": "fr line item with id 1", + "line-items:li_1": "fr line item with id 2", + "line-items:li_2": "fr line item with id 3", + "p_13": [ + "fr A paragraph with {1} is converted to {2}.", + "fr parameters", + "fr " + ], + "paragraph": [ + "fr A paragraph with {1} is converted to {2}.", + "fr id", + "fr " + ], + "text_15": " fr outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/simple-text-element/locales/simple-text-element.ru.json b/test/preprocess3/simple-text-element/locales/simple-text-element.ru.json new file mode 100644 index 00000000..66d9cf59 --- /dev/null +++ b/test/preprocess3/simple-text-element/locales/simple-text-element.ru.json @@ -0,0 +1,43 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "text": " ru outermost text at the beginning ", + "h1_3": "ru outermost header 1", + "text_4": " ru outermost text in the middle ", + "span_5": "ru simple text without id", + "span_6": "ru simple text without id 2", + "label-1": "ru simple text with id", + "label-2": "ru simple text with id 2", + "div_9:span": "ru simple text within div", + "div_9:span_1": "ru simple text within div 2", + "div_9:div_2:div": "ru great grandchild text within div", + "div_10:text": " ru simple text as the first element in div ", + "div_10:span_1": "ru simple text within div", + "div_10:text_2": " ru simple text in the middle of div ", + "div_10:span_3": "ru simple text within div 2", + "div_10:div_4:div": "ru great grandchild text within div", + "div_10:text_5": " ru simple text at the last element in div ", + "toplevel-div:span": "ru simple text within div", + "toplevel-div:span_1": "ru simple text within div 2", + "third-level-div": "ru great grandchild text within div", + "second-level-div:div_1": "ru great grandchild text within div without id", + "div_12:ul:li": "ru line item without id 1", + "div_12:ul:li_1": "ru line item without id 2", + "div_12:ul:li_2": "ru line item without id 3", + "line-items:li": "ru line item with id 1", + "line-items:li_1": "ru line item with id 2", + "line-items:li_2": "ru line item with id 3", + "p_13": [ + "ru A paragraph with {1} is converted to {2}.", + "ru parameters", + "ru " + ], + "paragraph": [ + "ru A paragraph with {1} is converted to {2}.", + "ru id", + "ru " + ], + "text_15": " ru outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/simple-text-element/simple-text-element.js b/test/preprocess3/simple-text-element/simple-text-element.js new file mode 100644 index 00000000..c2d6e8f4 --- /dev/null +++ b/test/preprocess3/simple-text-element/simple-text-element.js @@ -0,0 +1,413 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class SimpleTextElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`); + } + + static get is() { return 'simple-text-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(SimpleTextElement.is, SimpleTextElement); + } + break; +case 'base-element': + { + class SimpleTextElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`); + } + + static get is() { return 'simple-text-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(SimpleTextElement.is, SimpleTextElement); + } + break; +case 'thin': + { + Define = class SimpleTextElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + }; + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`), + + is: 'simple-text-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + listeners: { + 'lang-updated': '_langUpdated' + }, + + ready: function () { + //this.observeHtmlLang = false; + }, + + attached: function () { + }, + + _langUpdated: function (e) { + console.log(this.is, 'lang-updated', e.detail); + if (dom(e).rootTarget === this) { + this.model = deepcopy(this.text.model); + } + } + }); + } + break; +} diff --git a/test/preprocess3/simple-text-element/simple-text-element.json b/test/preprocess3/simple-text-element/simple-text-element.json new file mode 100644 index 00000000..f9b2ccf7 --- /dev/null +++ b/test/preprocess3/simple-text-element/simple-text-element.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "model": {}, + "text": " outermost text at the beginning ", + "h1_3": "outermost header 1", + "text_4": " outermost text in the middle ", + "span_5": "simple text without id", + "span_6": "simple text without id 2", + "label-1": "simple text with id", + "label-2": "simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "simple text within div", + "toplevel-div:span_1": "simple text within div 2", + "third-level-div": "great grandchild text within div", + "second-level-div:div_1": "great grandchild text within div without id", + "div_12:ul:li": "line item without id 1", + "div_12:ul:li_1": "line item without id 2", + "div_12:ul:li_2": "line item without id 3", + "line-items:li": "line item with id 1", + "line-items:li_1": "line item with id 2", + "line-items:li_2": "line item with id 3", + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "parameters", + "" + ], + "paragraph": [ + "A paragraph with {1} is converted to {2}.", + "id", + "" + ], + "text_15": " outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/simple-text-id-element/locales/simple-text-id-element.fr.json b/test/preprocess3/simple-text-id-element/locales/simple-text-id-element.fr.json new file mode 100755 index 00000000..5c2b608b --- /dev/null +++ b/test/preprocess3/simple-text-id-element/locales/simple-text-id-element.fr.json @@ -0,0 +1,49 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "text": " fr outermost text at the beginning ", + "h1_3": "fr outermost header 1", + "text_4": " fr outermost text in the middle ", + "span_5": "fr simple text without id", + "span_6": "fr simple text without id 2", + "label-1": "fr simple text with id", + "label-2": "fr simple text with id 2", + "div_9:span": "fr simple text within div", + "div_9:span_1": "fr simple text within div 2", + "div_9:div_2:div": "fr great grandchild text within div", + "div_10:text": " fr simple text as the first element in div ", + "div_10:span_1": "fr simple text within div", + "div_10:text_2": " fr simple text in the middle of div ", + "div_10:span_3": "fr simple text within div 2", + "div_10:div_4:div": "fr great grandchild text within div", + "div_10:text_5": " fr simple text at the last element in div ", + "toplevel-div:span": "fr simple text within div", + "toplevel-div:span_1": "fr simple text within div 2", + "second-level-div": [ + " fr {1}\n {2} ", + "fr great grandchild text within div", + "fr great grandchild text within div without id" + ], + "div_12:ul:li": "fr line item without id 1", + "div_12:ul:li_1": "fr line item without id 2", + "div_12:ul:li_2": "fr line item without id 3", + "line-items": [ + " fr {1}\n {2}\n {3} ", + "fr line item with id 1", + "fr line item with id 2", + "fr line item with id 3" + ], + "p_13": [ + "fr A paragraph with {1} is converted to {2}.", + "fr parameters", + "fr " + ], + "paragraph": [ + "fr A paragraph with {1} is converted to {2}.", + "fr id", + "fr " + ], + "text_15": " fr outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/simple-text-id-element/simple-text-id-element.js b/test/preprocess3/simple-text-id-element/simple-text-id-element.js new file mode 100644 index 00000000..42735e85 --- /dev/null +++ b/test/preprocess3/simple-text-id-element/simple-text-id-element.js @@ -0,0 +1,410 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class SimpleTextIdElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
{{text.second-level-div.0}}
{{text.second-level-div.1}}
{{text.second-level-div.2}}
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    {{text.line-items.0}}
  • {{text.line-items.1}}
  • {{text.line-items.2}}
  • {{text.line-items.3}}
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`); + } + + static get is() { return 'simple-text-id-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(SimpleTextIdElement.is, SimpleTextIdElement); + } + break; +case 'base-element': + { + class SimpleTextIdElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
{{text.second-level-div.0}}
{{text.second-level-div.1}}
{{text.second-level-div.2}}
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    {{text.line-items.0}}
  • {{text.line-items.1}}
  • {{text.line-items.2}}
  • {{text.line-items.3}}
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`); + } + + static get is() { return 'simple-text-id-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(SimpleTextIdElement.is, SimpleTextIdElement); + } + break; +case 'thin': + { + Define = class SimpleTextIdElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + }; + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
{{text.second-level-div.0}}
{{text.second-level-div.1}}
{{text.second-level-div.2}}
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    {{text.line-items.0}}
  • {{text.line-items.1}}
  • {{text.line-items.2}}
  • {{text.line-items.3}}
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`), + + is: 'simple-text-id-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + listeners: { + 'lang-updated': '_langUpdated' + }, + + ready: function () { + //this.observeHtmlLang = false; + }, + + attached: function () { + }, + + _langUpdated: function (e) { + console.log(this.is, 'lang-updated', e.detail); + if (dom(e).rootTarget === this) { + this.model = deepcopy(this.text.model); + } + } + }); + } + break; +} diff --git a/test/preprocess3/simple-text-id-element/simple-text-id-element.json b/test/preprocess3/simple-text-id-element/simple-text-id-element.json new file mode 100644 index 00000000..0e01076e --- /dev/null +++ b/test/preprocess3/simple-text-id-element/simple-text-id-element.json @@ -0,0 +1,47 @@ +{ + "meta": {}, + "model": {}, + "text": " outermost text at the beginning ", + "h1_3": "outermost header 1", + "text_4": " outermost text in the middle ", + "span_5": "simple text without id", + "span_6": "simple text without id 2", + "label-1": "simple text with id", + "label-2": "simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "simple text within div", + "toplevel-div:span_1": "simple text within div 2", + "second-level-div": [ + " {1}\n {2} ", + "great grandchild text within div", + "great grandchild text within div without id" + ], + "div_12:ul:li": "line item without id 1", + "div_12:ul:li_1": "line item without id 2", + "div_12:ul:li_2": "line item without id 3", + "line-items": [ + " {1}\n {2}\n {3} ", + "line item with id 1", + "line item with id 2", + "line item with id 3" + ], + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "parameters", + "" + ], + "paragraph": [ + "A paragraph with {1} is converted to {2}.", + "id", + "" + ], + "text_15": " outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/template-default-lang-test-imports.js b/test/preprocess3/template-default-lang-test-imports.js new file mode 100644 index 00000000..9fde3551 --- /dev/null +++ b/test/preprocess3/template-default-lang-test-imports.js @@ -0,0 +1,23 @@ +import './fake-server.js'; +import './test-runner.js'; +import '../../i18n-element.js'; +import '../../define-element.js'; +import '../../i18n-dom-bind.js'; +import './template-default-lang/template-default-lang-element.js'; +import './template-default-lang/null-template-default-lang-element.js'; +import './template-default-lang-test-suites.js'; + +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +/* + + +*/ +/* + FIXME(polymer-modulizer): the above comments were extracted + from HTML and may be out of place here. Review them and + then delete this comment! +*/ +; diff --git a/test/preprocess3/template-default-lang-test-suites.js b/test/preprocess3/template-default-lang-test-suites.js new file mode 100644 index 00000000..c176bca3 --- /dev/null +++ b/test/preprocess3/template-default-lang-test-suites.js @@ -0,0 +1,325 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import './test-runner.js'; +suite('I18nElement with ' + + (window.location.href.indexOf('?dom=Shadow') >= 0 ? 'Shadow DOM' : 'Shady DOM') + + (' in ' + syntax + ' syntax'), + function () { + + var lang0 = ''; + var lang1 = 'en'; + var lang2 = 'fr'; + var lang3 = 'ja'; + var lang4 = 'fr-CA'; + var lang5 = 'zh-Hans-CN'; + var lang6 = 'ru'; + var text_template_default_lang = { + 'model': {}, + 'text': ' outermost text at the beginning ', + 'h1_3': 'outermost header 1', + 'text_4': ' outermost text in the middle ', + 'span_5': 'simple text without id', + 'span_6': 'simple text without id 2', + 'label-1': 'simple text with id', + 'label-2': 'simple text with id 2', + 'div_9:span': 'simple text within div', + 'div_9:span_1': 'simple text within div 2', + 'div_9:div_2:div': 'great grandchild text within div', + 'div_10:text': ' simple text as the first element in div ', + 'div_10:span_1': 'simple text within div', + 'div_10:text_2': ' simple text in the middle of div ', + 'div_10:span_3': 'simple text within div 2', + 'div_10:div_4:div': 'great grandchild text within div', + 'div_10:text_5': ' simple text at the last element in div ', + 'toplevel-div:span': 'simple text within div', + 'toplevel-div:span_1': 'simple text within div 2', + 'third-level-div': 'great grandchild text within div', + 'second-level-div:div_1': 'great grandchild text within div without id', + 'div_12:ul:li': 'line item without id 1', + 'div_12:ul:li_1': 'line item without id 2', + 'div_12:ul:li_2': 'line item without id 3', + 'line-items:li': 'line item with id 1', + 'line-items:li_1': 'line item with id 2', + 'line-items:li_2': 'line item with id 3', + 'p_13': [ + 'A paragraph with {1} is converted to {2}.', + 'parameters', + '' + ], + 'paragraph': [ + 'A paragraph with {1} is converted to {2}.', + 'id', + '' + ], + 'text_15': ' outermost text at the end ' + }; + var text_template_default_lang_fr = { + 'model': {}, + 'text': ' fr outermost text at the beginning ', + 'h1_3': 'fr outermost header 1', + 'text_4': ' fr outermost text in the middle ', + 'span_5': 'fr simple text without id', + 'span_6': 'fr simple text without id 2', + 'label-1': 'fr simple text with id', + 'label-2': 'fr simple text with id 2', + 'div_9:span': 'fr simple text within div', + 'div_9:span_1': 'fr simple text within div 2', + 'div_9:div_2:div': 'fr great grandchild text within div', + 'div_10:text': ' fr simple text as the first element in div ', + 'div_10:span_1': 'fr simple text within div', + 'div_10:text_2': ' fr simple text in the middle of div ', + 'div_10:span_3': 'fr simple text within div 2', + 'div_10:div_4:div': 'fr great grandchild text within div', + 'div_10:text_5': ' fr simple text at the last element in div ', + 'toplevel-div:span': 'fr simple text within div', + 'toplevel-div:span_1': 'fr simple text within div 2', + 'third-level-div': 'fr great grandchild text within div', + 'second-level-div:div_1': 'fr great grandchild text within div without id', + 'div_12:ul:li': 'fr line item without id 1', + 'div_12:ul:li_1': 'fr line item without id 2', + 'div_12:ul:li_2': 'fr line item without id 3', + 'line-items:li': 'fr line item with id 1', + 'line-items:li_1': 'fr line item with id 2', + 'line-items:li_2': 'fr line item with id 3', + 'p_13': [ + 'fr A paragraph with {1} is converted to {2}.', + 'fr parameters', + 'fr ' + ], + 'paragraph': [ + 'fr A paragraph with {1} is converted to {2}.', + 'fr id', + 'fr ' + ], + 'text_15': ' fr outermost text at the end ' + }; + var localDOM_template_default_lang = [ + { select: 'div:not([id])', 'previousTextSibling.data.trim': ' outermost text at the beginning ' }, + { select: 'h1', textContent: 'outermost header 1' }, + { select: 'h1', 'nextTextSibling.data.trim': ' outermost text in the middle ' }, + { select: 'span:not([id])', textContent: [ 'simple text without id', 'simple text without id 2' ] }, + { select: 'span[id="label-1"]', textContent: 'simple text with id' }, + { select: 'span[id="label-2"]', textContent: 'simple text with id 2' }, + { select: 'span[id="label-2"] + div span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[id="label-2"] + div div:not([id]) div:not([id])', textContent: [ 'great grandchild text within div' ] }, + { select: 'span[id="label-2"] + div + div', 'childNodes.0.data.trim': ' simple text as the first element in div ' }, + { select: 'span[id="label-2"] + div + div span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[id="label-2"] + div + div span:not([id])', 'nextTextSibling.data.trim': ' simple text in the middle of div ' }, + { select: 'span[id="label-2"] + div + div div:not([id]) div:not([id])', textContent: 'great grandchild text within div' }, + { select: 'span[id="label-2"] + div + div div:not([id])', 'nextTextSibling.data.trim': ' simple text at the last element in div ' }, + { select: '[id="toplevel-div"] span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: '[id="third-level-div"]', textContent: 'great grandchild text within div' }, + { select: '[id="second-level-div"] div:not([id])', textContent: 'great grandchild text within div without id' }, + { select: 'div ul:not([id]) li:not([id])', textContent: [ 'line item without id 1', 'line item without id 2', 'line item without id 3' ] }, + { select: '[id="line-items"] li:not([id])', textContent: [ 'line item with id 1', 'line item with id 2', 'line item with id 3' ] }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.0.textContent': 'A paragraph with {1} is converted to {2}.' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'parameters', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': '', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.0.textContent': 'A paragraph with {1} is converted to {2}.' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'id', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': '', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"]', 'nextTextSibling.data.trim': ' outermost text at the end ' } + ]; + var localDOM_template_default_lang_fr = [ + { select: 'div:not([id])', 'previousTextSibling.data.trim': 'fr outermost text at the beginning' }, + { select: 'h1', textContent: 'fr outermost header 1' }, + { select: 'h1', 'nextTextSibling.data.trim': 'fr outermost text in the middle' }, + { select: 'span:not([id])', textContent: [ 'fr simple text without id', 'fr simple text without id 2' ] }, + { select: 'span[id="label-1"]', textContent: 'fr simple text with id' }, + { select: 'span[id="label-2"]', textContent: 'fr simple text with id 2' }, + { select: 'span[id="label-2"] + div span:not([id])', textContent: [ 'fr simple text within div', 'fr simple text within div 2' ] }, + { select: 'span[id="label-2"] + div div:not([id]) div:not([id])', textContent: [ 'fr great grandchild text within div' ] }, + { select: 'span[id="label-2"] + div + div', 'childNodes.0.data.trim': 'fr simple text as the first element in div' }, + { select: 'span[id="label-2"] + div + div span:not([id])', textContent: [ 'fr simple text within div', 'fr simple text within div 2' ] }, + { select: 'span[id="label-2"] + div + div span:not([id])', 'nextTextSibling.data.trim': 'fr simple text in the middle of div' }, + { select: 'span[id="label-2"] + div + div div:not([id]) div:not([id])', textContent: 'fr great grandchild text within div' }, + { select: 'span[id="label-2"] + div + div div:not([id])', 'nextTextSibling.data.trim': 'fr simple text at the last element in div' }, + { select: '[id="toplevel-div"] span:not([id])', textContent: [ 'fr simple text within div', 'fr simple text within div 2' ] }, + { select: '[id="third-level-div"]', textContent: 'fr great grandchild text within div' }, + { select: '[id="second-level-div"] div:not([id])', textContent: 'fr great grandchild text within div without id' }, + { select: 'div ul:not([id]) li:not([id])', textContent: [ 'fr line item without id 1', 'fr line item without id 2', 'fr line item without id 3' ] }, + { select: '[id="line-items"] li:not([id])', textContent: [ 'fr line item with id 1', 'fr line item with id 2', 'fr line item with id 3' ] }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.0.textContent': 'fr A paragraph with {1} is converted to {2}.' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'fr parameters', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': 'fr ', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.0.textContent': 'fr A paragraph with {1} is converted to {2}.' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'fr id', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': 'fr ', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"]', 'nextTextSibling.data.trim': 'fr outermost text at the end' } + ]; + var text_simple = { + 'model': {}, + 'text': ' outermost text at the beginning ', + 'h1_3': 'outermost header 1', + 'text_4': ' outermost text in the middle ', + 'span_5': 'simple text without id', + 'span_6': 'simple text without id 2', + 'label-1': 'simple text with id', + 'label-2': 'simple text with id 2', + 'div_9:span': 'simple text within div', + 'div_9:span_1': 'simple text within div 2', + 'div_9:div_2:div': 'great grandchild text within div', + 'div_10:text': ' simple text as the first element in div ', + 'div_10:span_1': 'simple text within div', + 'div_10:text_2': ' simple text in the middle of div ', + 'div_10:span_3': 'simple text within div 2', + 'div_10:div_4:div': 'great grandchild text within div', + 'div_10:text_5': ' simple text at the last element in div ', + 'toplevel-div:span': 'simple text within div', + 'toplevel-div:span_1': 'simple text within div 2', + 'third-level-div': 'great grandchild text within div', + 'second-level-div:div_1': 'great grandchild text within div without id', + 'div_12:ul:li': 'line item without id 1', + 'div_12:ul:li_1': 'line item without id 2', + 'div_12:ul:li_2': 'line item without id 3', + 'line-items:li': 'line item with id 1', + 'line-items:li_1': 'line item with id 2', + 'line-items:li_2': 'line item with id 3', + 'p_13': [ + 'A paragraph with {1} is converted to {2}.', + 'parameters', + '' + ], + 'paragraph': [ + 'A paragraph with {1} is converted to {2}.', + 'id', + '' + ], + 'text_15': ' outermost text at the end ' + }; + var localDOM_simple = [ + { select: 'div:not([id])', 'previousTextSibling.data.trim': 'outermost text at the beginning' }, + { select: 'h1', textContent: 'outermost header 1' }, + { select: 'h1', 'nextTextSibling.data.trim': 'outermost text in the middle' }, + { select: 'span:not([id])', textContent: [ 'simple text without id', 'simple text without id 2' ] }, + { select: 'span[id="label-1"]', textContent: 'simple text with id' }, + { select: 'span[id="label-2"]', textContent: 'simple text with id 2' }, + { select: 'span[id="label-2"] + div span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[id="label-2"] + div div:not([id]) div:not([id])', textContent: [ 'great grandchild text within div' ] }, + { select: 'span[id="label-2"] + div + div', 'childNodes.0.data.trim': 'simple text as the first element in div' }, + { select: 'span[id="label-2"] + div + div span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[id="label-2"] + div + div span:not([id])', 'nextTextSibling.data.trim': 'simple text in the middle of div' }, + { select: 'span[id="label-2"] + div + div div:not([id]) div:not([id])', textContent: 'great grandchild text within div' }, + { select: 'span[id="label-2"] + div + div div:not([id])', 'nextTextSibling.data.trim': 'simple text at the last element in div' }, + { select: '[id="toplevel-div"] span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: '[id="third-level-div"]', textContent: 'great grandchild text within div' }, + { select: '[id="second-level-div"] div:not([id])', textContent: 'great grandchild text within div without id' }, + { select: 'div ul:not([id]) li:not([id])', textContent: [ 'line item without id 1', 'line item without id 2', 'line item without id 3' ] }, + { select: '[id="line-items"] li:not([id])', textContent: [ 'line item with id 1', 'line item with id 2', 'line item with id 3' ] }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.0.textContent': 'A paragraph with {1} is converted to {2}.' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'parameters', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': '', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.0.textContent': 'A paragraph with {1} is converted to {2}.' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'id', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': '', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"]', 'nextTextSibling.data.trim': 'outermost text at the end' } + ]; + + var suites = [ + s('template default lang element', null, { + fixture: 'template-default-lang-element-fixture', + fixtureModel: undefined, + assign: undefined, + lang: lang0, + effectiveLang: lang0, + templateDefaultLang: lang2, + observeHtmlLang: true, + text: text_template_default_lang_fr, + model: {}, + localDOM: localDOM_template_default_lang_fr, + lightDOM: undefined + }), + s(lang6 + ' template default lang element', 'template default lang element', { + timeout: 60000, + assign: { lang: lang6 }, + lang: lang0, + effectiveLang: lang0 + }), + s(lang5 + ' template default lang element', 'template default lang element', { + timeout: 60000, + assign: { lang: lang5 }, + lang: lang5, + effectiveLang: lang5, + text: text_template_default_lang, + localDOM: localDOM_template_default_lang + }), + s('null template default lang element', null, { + fixture: 'null-template-default-lang-element-fixture', + fixtureModel: undefined, + assign: undefined, + lang: lang0, + effectiveLang: lang0, + templateDefaultLang: lang0, + observeHtmlLang: true, + text: text_simple, + model: {}, + localDOM: localDOM_simple, + lightDOM: undefined + }), + s(lang6 + ' null template default lang element', 'null template default lang element', { + timeout: 60000, + assign: { lang: lang6 }, + lang: lang0, + effectiveLang: lang0 + }), + s(lang5 + ' null template default lang element', 'null template default lang element', { + timeout: 60000, + assign: { lang: lang5 }, + lang: lang5, + effectiveLang: lang5 + }), + s(lang3 + ' null template default lang element', 'null template default lang element', { + timeout: 60000, + assign: { lang: lang3 }, + lang: lang0, + effectiveLang: lang0 + }), + ]; + + suitesRunner(suites); + +}); diff --git a/test/preprocess3/template-default-lang-test.html b/test/preprocess3/template-default-lang-test.html new file mode 100644 index 00000000..0d7710d7 --- /dev/null +++ b/test/preprocess3/template-default-lang-test.html @@ -0,0 +1,37 @@ + + + + + + + + + + + +

+ + + + + + + + + + + \ No newline at end of file diff --git a/test/preprocess3/template-default-lang/locales/null-template-default-lang-element.zh-Hans-CN.json b/test/preprocess3/template-default-lang/locales/null-template-default-lang-element.zh-Hans-CN.json new file mode 100755 index 00000000..e27ea8dc --- /dev/null +++ b/test/preprocess3/template-default-lang/locales/null-template-default-lang-element.zh-Hans-CN.json @@ -0,0 +1,43 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "text": " zh-Hans-CN outermost text at the beginning ", + "h1_3": "zh-Hans-CN outermost header 1", + "text_4": " zh-Hans-CN outermost text in the middle ", + "span_5": "zh-Hans-CN simple text without id", + "span_6": "zh-Hans-CN simple text without id 2", + "label-1": "zh-Hans-CN simple text with id", + "label-2": "zh-Hans-CN simple text with id 2", + "div_9:span": "zh-Hans-CN simple text within div", + "div_9:span_1": "zh-Hans-CN simple text within div 2", + "div_9:div_2:div": "zh-Hans-CN great grandchild text within div", + "div_10:text": " zh-Hans-CN simple text as the first element in div ", + "div_10:span_1": "zh-Hans-CN simple text within div", + "div_10:text_2": " zh-Hans-CN simple text in the middle of div ", + "div_10:span_3": "zh-Hans-CN simple text within div 2", + "div_10:div_4:div": "zh-Hans-CN great grandchild text within div", + "div_10:text_5": " zh-Hans-CN simple text at the last element in div ", + "toplevel-div:span": "zh-Hans-CN simple text within div", + "toplevel-div:span_1": "zh-Hans-CN simple text within div 2", + "third-level-div": "zh-Hans-CN great grandchild text within div", + "second-level-div:div_1": "zh-Hans-CN great grandchild text within div without id", + "div_12:ul:li": "zh-Hans-CN line item without id 1", + "div_12:ul:li_1": "zh-Hans-CN line item without id 2", + "div_12:ul:li_2": "zh-Hans-CN line item without id 3", + "line-items:li": "zh-Hans-CN line item with id 1", + "line-items:li_1": "zh-Hans-CN line item with id 2", + "line-items:li_2": "zh-Hans-CN line item with id 3", + "p_13": [ + "zh-Hans-CN A paragraph with {1} is converted to {2}.", + "zh-Hans-CN parameters", + "zh-Hans-CN " + ], + "paragraph": [ + "zh-Hans-CN A paragraph with {1} is converted to {2}.", + "zh-Hans-CN id", + "zh-Hans-CN " + ], + "text_15": " zh-Hans-CN outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/template-default-lang/locales/template-default-lang-element.zh-Hans-CN.json b/test/preprocess3/template-default-lang/locales/template-default-lang-element.zh-Hans-CN.json new file mode 100755 index 00000000..e27ea8dc --- /dev/null +++ b/test/preprocess3/template-default-lang/locales/template-default-lang-element.zh-Hans-CN.json @@ -0,0 +1,43 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "text": " zh-Hans-CN outermost text at the beginning ", + "h1_3": "zh-Hans-CN outermost header 1", + "text_4": " zh-Hans-CN outermost text in the middle ", + "span_5": "zh-Hans-CN simple text without id", + "span_6": "zh-Hans-CN simple text without id 2", + "label-1": "zh-Hans-CN simple text with id", + "label-2": "zh-Hans-CN simple text with id 2", + "div_9:span": "zh-Hans-CN simple text within div", + "div_9:span_1": "zh-Hans-CN simple text within div 2", + "div_9:div_2:div": "zh-Hans-CN great grandchild text within div", + "div_10:text": " zh-Hans-CN simple text as the first element in div ", + "div_10:span_1": "zh-Hans-CN simple text within div", + "div_10:text_2": " zh-Hans-CN simple text in the middle of div ", + "div_10:span_3": "zh-Hans-CN simple text within div 2", + "div_10:div_4:div": "zh-Hans-CN great grandchild text within div", + "div_10:text_5": " zh-Hans-CN simple text at the last element in div ", + "toplevel-div:span": "zh-Hans-CN simple text within div", + "toplevel-div:span_1": "zh-Hans-CN simple text within div 2", + "third-level-div": "zh-Hans-CN great grandchild text within div", + "second-level-div:div_1": "zh-Hans-CN great grandchild text within div without id", + "div_12:ul:li": "zh-Hans-CN line item without id 1", + "div_12:ul:li_1": "zh-Hans-CN line item without id 2", + "div_12:ul:li_2": "zh-Hans-CN line item without id 3", + "line-items:li": "zh-Hans-CN line item with id 1", + "line-items:li_1": "zh-Hans-CN line item with id 2", + "line-items:li_2": "zh-Hans-CN line item with id 3", + "p_13": [ + "zh-Hans-CN A paragraph with {1} is converted to {2}.", + "zh-Hans-CN parameters", + "zh-Hans-CN " + ], + "paragraph": [ + "zh-Hans-CN A paragraph with {1} is converted to {2}.", + "zh-Hans-CN id", + "zh-Hans-CN " + ], + "text_15": " zh-Hans-CN outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/template-default-lang/null-template-default-lang-element.js b/test/preprocess3/template-default-lang/null-template-default-lang-element.js new file mode 100644 index 00000000..eedd8ee1 --- /dev/null +++ b/test/preprocess3/template-default-lang/null-template-default-lang-element.js @@ -0,0 +1,409 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class NullTemplateDefaultLangElement extends Mixins.Logger(Mixins.Localizable(LegacyElementMixin(HTMLElement))) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("lang", ""); return t; })(((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`)); + } + + static get is() { return 'null-template-default-lang-element'; } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated(e) { + if (e.composedPath()[0] === this && this.text) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(NullTemplateDefaultLangElement.is, NullTemplateDefaultLangElement); + } + break; +case 'base-element': + { + class NullTemplateDefaultLangElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("lang", ""); return t; })(((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`)); + } + + static get is() { return 'null-template-default-lang-element'; } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated(e) { + if (e.composedPath()[0] === this && this.text) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(NullTemplateDefaultLangElement.is, NullTemplateDefaultLangElement); + } + break; +case 'thin': + { + Define = class NullTemplateDefaultLangElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated(e) { + if (e.composedPath()[0] === this && this.text) { + this.model = deepcopy(this.text.model); + } + } + } + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("lang", ""); return t; })(((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`)), + + is: 'null-template-default-lang-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + listeners: { + 'lang-updated': '_langUpdated' + }, + + ready: function () { + //this.observeHtmlLang = false; + }, + + attached: function () { + }, + + _langUpdated: function (e) { + if (dom(e).rootTarget === this && this.text) { + this.model = deepcopy(this.text.model); + } + } + }); + } + break; +} diff --git a/test/preprocess3/template-default-lang/null-template-default-lang-element.json b/test/preprocess3/template-default-lang/null-template-default-lang-element.json new file mode 100644 index 00000000..f9b2ccf7 --- /dev/null +++ b/test/preprocess3/template-default-lang/null-template-default-lang-element.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "model": {}, + "text": " outermost text at the beginning ", + "h1_3": "outermost header 1", + "text_4": " outermost text in the middle ", + "span_5": "simple text without id", + "span_6": "simple text without id 2", + "label-1": "simple text with id", + "label-2": "simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "simple text within div", + "toplevel-div:span_1": "simple text within div 2", + "third-level-div": "great grandchild text within div", + "second-level-div:div_1": "great grandchild text within div without id", + "div_12:ul:li": "line item without id 1", + "div_12:ul:li_1": "line item without id 2", + "div_12:ul:li_2": "line item without id 3", + "line-items:li": "line item with id 1", + "line-items:li_1": "line item with id 2", + "line-items:li_2": "line item with id 3", + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "parameters", + "" + ], + "paragraph": [ + "A paragraph with {1} is converted to {2}.", + "id", + "" + ], + "text_15": " outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/template-default-lang/template-default-lang-element.js b/test/preprocess3/template-default-lang/template-default-lang-element.js new file mode 100644 index 00000000..c69193d9 --- /dev/null +++ b/test/preprocess3/template-default-lang/template-default-lang-element.js @@ -0,0 +1,409 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class TemplateDefaultLangElement extends Mixins.Logger(Mixins.Localizable(LegacyElementMixin(HTMLElement))) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("lang", "fr"); return t; })(((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`)); + } + + static get is() { return 'template-default-lang-element'; } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated(e) { + if (e.composedPath()[0] === this && this.text) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(TemplateDefaultLangElement.is, TemplateDefaultLangElement); + } + break; +case 'base-element': + { + class TemplateDefaultLangElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("lang", "fr"); return t; })(((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`)); + } + + static get is() { return 'template-default-lang-element'; } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated(e) { + if (e.composedPath()[0] === this && this.text) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(TemplateDefaultLangElement.is, TemplateDefaultLangElement); + } + break; +case 'thin': + { + Define = class TemplateDefaultLangElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated(e) { + if (e.composedPath()[0] === this && this.text) { + this.model = deepcopy(this.text.model); + } + } + } + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("lang", "fr"); return t; })(((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`)), + + is: 'template-default-lang-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + listeners: { + 'lang-updated': '_langUpdated' + }, + + ready: function () { + //this.observeHtmlLang = false; + }, + + attached: function () { + }, + + _langUpdated: function (e) { + if (dom(e).rootTarget === this && this.text) { + this.model = deepcopy(this.text.model); + } + } + }); + } + break; +} diff --git a/test/preprocess3/template-default-lang/template-default-lang-element.json b/test/preprocess3/template-default-lang/template-default-lang-element.json new file mode 100644 index 00000000..21a74b9c --- /dev/null +++ b/test/preprocess3/template-default-lang/template-default-lang-element.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "model": {}, + "text": " fr outermost text at the beginning ", + "h1_3": "fr outermost header 1", + "text_4": " fr outermost text in the middle ", + "span_5": "fr simple text without id", + "span_6": "fr simple text without id 2", + "label-1": "fr simple text with id", + "label-2": "fr simple text with id 2", + "div_9:span": "fr simple text within div", + "div_9:span_1": "fr simple text within div 2", + "div_9:div_2:div": "fr great grandchild text within div", + "div_10:text": " fr simple text as the first element in div ", + "div_10:span_1": "fr simple text within div", + "div_10:text_2": " fr simple text in the middle of div ", + "div_10:span_3": "fr simple text within div 2", + "div_10:div_4:div": "fr great grandchild text within div", + "div_10:text_5": " fr simple text at the last element in div ", + "toplevel-div:span": "fr simple text within div", + "toplevel-div:span_1": "fr simple text within div 2", + "third-level-div": "fr great grandchild text within div", + "second-level-div:div_1": "fr great grandchild text within div without id", + "div_12:ul:li": "fr line item without id 1", + "div_12:ul:li_1": "fr line item without id 2", + "div_12:ul:li_2": "fr line item without id 3", + "line-items:li": "fr line item with id 1", + "line-items:li_1": "fr line item with id 2", + "line-items:li_2": "fr line item with id 3", + "p_13": [ + "fr A paragraph with {1} is converted to {2}.", + "fr parameters", + "fr " + ], + "paragraph": [ + "fr A paragraph with {1} is converted to {2}.", + "fr id", + "fr " + ], + "text_15": " fr outermost text at the end " +} \ No newline at end of file diff --git a/test/preprocess3/test-runner.js b/test/preprocess3/test-runner.js new file mode 100755 index 00000000..3d8686e8 --- /dev/null +++ b/test/preprocess3/test-runner.js @@ -0,0 +1,721 @@ +/*! + * @license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md + * Copyright (c) 2016, Tetsuya Mori . All rights reserved. + */ +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import { templatize } from '@polymer/polymer/lib/utils/templatize.js'; +import { PolymerElement } from '@polymer/polymer/polymer-element.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; + +window.deepcopy = deepcopy; + +if (!Number.isNaN) { + // polyfill Number.isNaN for IE11 + Number.isNaN = function (value) { + return typeof value === 'number' && isNaN(value); + }; +} + +// Inheritance of test parameters +window.p = Object.setPrototypeOf || function (target, base) { + var obj = Object.create(base); + for (var p in target) { + obj[p] = target[p]; + } + return obj; +}; +window.g = Object.getPrototypeOf; +window._name = 'suite'; +window.suiteMap = { null: {} }; +window.s = function (name, baseName, extension) { + if (suiteMap[name]) { + throw new Error('duplicate suite name ' + name); + } + if (!suiteMap[baseName]) { + throw new Error('inexistent base suite name ' + baseName); + } + extension[_name] = name; + extension = p(extension, suiteMap[baseName]); + suiteMap[name] = extension; + return extension; +}; + +// Utility functions + +window.updateProperty = function updateProperty (element, properties) { + for (var name in properties) { + var path = name.split(/[.]/); + if (path.length === 1) { + element[name] = properties[name]; + } + else { + var cursor = element; + var p = path.shift(); + while (p) { + if (path.length < 1) { + cursor[p] = properties[name]; + element.notifyPath(name, properties[name], true); + break; + } + else if (p === 'PolymerDom') { + cursor = dom(cursor); + } + else if (p === 'html') { + cursor = document.querySelector('html'); + } + else { + cursor = cursor[p]; + } + p = path.shift(); + } + } + } +} + +window.getProperty = function getProperty (target, name) { + var path = name.split(/[.]/); + if (path.length === 1) { + switch (name) { + case 'textContent': + return Array.prototype.map.call(target.childNodes, function (n) { return n.nodeType === n.TEXT_NODE ? n.textContent : ''; }).join(''); + default: + return target[name]; + break; + } + } + else { + var cursor = target; + var p = path.shift(); + while (p) { + //console.log(p, cursor); + if (path.length < 1) { + if (p === 'raw' || + p === 'text') { + return cursor; + } + else if (p === 'trim') { + return cursor.trim(); + } + if (p === 'data') { + cursor = cursor[p]; + cursor = cursor.replace(/^[\s]{1,}/g, ' ').replace(/[\s]{1,}$/g, ' '); + return cursor; + } + else { + return cursor[p]; + } + } + else if (p === 'PolymerDom') { + cursor = dom(cursor); + } + else if (p === 'previousTextSibling') { + do { + cursor = cursor.previousSibling; + } while (cursor.nodeType === cursor.COMMENT_NODE || + (cursor.nodeType === cursor.TEXT_NODE && cursor.data.match(/^[\s]*$/))); + } + else if (p === 'nextTextSibling') { + do { + cursor = cursor.nextSibling; + } while (cursor.nodeType === cursor.COMMENT_NODE || + (cursor.nodeType === cursor.TEXT_NODE && cursor.data.match(/^[\s]*$/))); + } + else if (p === 'effectiveChildNodes') { + cursor = cursor.getEffectiveChildNodes(); + } + else if (p === 'nonWS') { + cursor = Array.prototype.filter.call(cursor, function (item) { + return (item.nodeType !== item.TEXT_NODE && + item.nodeType !== item.COMMENT_NODE) || + (item.nodeType === item.TEXT_NODE && + !item.data.match(/^[\s]*$/)); + }); + } + else { + cursor = cursor[p]; + } + p = path.shift(); + } + } +} + +window.deepMap = function deepMap (target, source, map) { + var value; + for (var prop in source) { + value = source[prop]; + switch (typeof value) { + case 'string': + case 'number': + case 'boolean': + if (typeof target === 'object') { + target[prop] = map(value, prop); + } + break; + case 'object': + if (typeof target === 'object') { + if (Array.isArray(value)) { + target[prop] = target[prop] || []; + deepMap(target[prop], value, map); + } + else { + target[prop] = target[prop] || {}; + deepMap(target[prop], value, map); + } + } + break; + case 'function': + case 'symbol': + case 'undefined': + if (typeof target === 'object') { + target[prop] = value; + } + break; + default: + if (typeof target === 'object') { + target[prop] = value; + } + break; + } + } + return target; +} + +window.translate = function translate (lang, path, text) { + var result; + switch (lang) { + case '': + case 'en': + case null: + case undefined: + result = text; + break; + default: + if (!path || path.match(/(textContent|[.]data|[.]text|[.]trim)$/)) { + result = {}; + deepMap(result, { text: text }, function (value, prop) { + if (typeof value === 'string' && + !value.match(/^({{[^{}]*}}|\[\[[^\[\]]*\]\])$/) && + !value.match(/^[0-9]{1,}$/) && + prop !== 'type') { + if (path && path.match(/[.]trim$/)) { + return minifyText((lang + ' ' + value).trim()); + } + else { + if (value.match(/^ /)) { + return minifyText(' ' + lang + ' ' + value); + } + else { + return minifyText(lang + ' ' + value); + } + } + } + return minifyText(value); + }); + result = result.text; + } + else { + result = text; + } + } + //console.log('translate (' + lang + ', ' + path + ', ' + JSON.stringify(text, null, 2) + ') = ' + JSON.stringify(result, null, 2)); + return result; +} + +window.minifyText = function minifyText (text) { + if (text && typeof text === 'string') { + text = text.replace(/[\s]{1,}/g, ' '); + } + return text; +} + +window.isFakeServer = typeof window === 'object' && + typeof window.location.href === 'string' && + window.location.href.indexOf('xhr=fake') > 0 && + typeof window.fakeServerContents === 'object'; + +window.isSuppressingSuiteParams = typeof window === 'object' && + typeof window.location.href === 'string' && + window.location.href.indexOf('suppress=true') > 0; + +window.syntax = 'mixin'; +(function () { + var href = typeof window === 'object' && typeof window.location.href === 'string' + ? window.location.href : '' + if (href) { + [ 'mixin', 'base-element', 'thin', 'legacy', 'modified-legacy' ].forEach(function (_syntax) { + if (href.indexOf('syntax=' + _syntax) > 0) { + syntax = _syntax; + } + }); + } +})(); + +window.setupFakeServer = function setupFakeServer (e) { + if (isFakeServer) { + e.server = sinon.fakeServer.create(); + e.server.autoRespond = true; + //e.server.autoRespondAfter = 100; + e.server.respondImmediately = true; + e.server.respondWith(/\/test\/[-\w]+(\/.*[.]json)$/, function (xhr, urlPath) { + if (fakeServerContents.hasOwnProperty(urlPath)) { + //console.log('fake-server: 200 ' + urlPath); + xhr.respond(200, { 'Content-Type': 'application/json' }, fakeServerContents[urlPath]) + } + else { + //console.log('fake-server: 404 ' + urlPath); + xhr.respond(404, {}, ''); + } + }); + } +} + +window.teardownFakeServer = function teardownFakeServer (e) { + if (isFakeServer) { + e.server.restore(); + } +} + +window.setupFixture = function setupFixture (params, fixtureModel) { + var fixtureName = params.fixture; + var e = document.querySelector('#' + fixtureName); + var runningTest = document.querySelectorAll('.running-test'); + var title = document.querySelector('#test-name'); + var currentPath = window.location.pathname.split('/'); + if (!e) { + throw new Error('Fixture element with id = ' + fixtureName + ' not found'); + } + if (title) { + title.textContent = + (currentPath.length >= 2 ? currentPath[currentPath.length - 2] : '') + + (currentPath.length >= 1 ? '/' + currentPath[currentPath.length - 1].replace(/-test[.]html$/, '') + '/': '') + + params.suite; + } + //console.log('setupFixture: suite = ' + params.suite); + if (e.is === 'i18n-dom-bind') { + e.parentElement.classList.add('running-test'); + Array.prototype.forEach.call(runningTest, function (node) { + if (node !== e.parentElement) { + node.classList.remove('running-test'); + } + }); + return new Promise(function (resolve, reject) { + e.addEventListener('dom-change', function setupFixtureDomChange (ev) { + if (dom(ev).rootTarget === e) { + //console.log('setupFixture dom-change'); + e.removeEventListener('dom-change', setupFixtureDomChange); + try { + if (fixtureModel && + typeof fixtureModel.lang === 'string' && + fixtureModel.lang !== 'en') { + //console.log('setupFixture: waiting for lang-updated'); + e.addEventListener('lang-updated', function setupFixtureLangDomChange (event) { + //console.log('setupFixtureLangDomChange'); + if (event.target === e && + e.effectiveLang === fixtureModel.lang) { + //console.log('setupFixtureLangDomChange lang = ' + event.detail.lang + ' effectiveLang = ' + e.effectiveLang); + e.removeEventListener('lang-updated', setupFixtureLangDomChange); + e.render(); + resolve(e); + } + }); + for (var p in fixtureModel) { + e[p] = fixtureModel[p]; + } + e.params = params; + } + else { + for (var p in fixtureModel) { + e[p] = fixtureModel[p]; + } + e.params = params; + //console.log('setupFixture: resolving'); + e.render(); + resolve(e); + } + } + catch (ex) { + reject(ex); + } + } + }); + if (e._children) { + e.render(); + } + }); + } + else { + e.classList.add('running-test'); + Array.prototype.forEach.call(runningTest, function (node) { + if (node !== e) { + node.classList.remove('running-test'); + } + }); + setupFakeServer(e); + return new Promise(function (resolve, reject) { + //console.log('setupFixture: name = ' + fixtureName + ' model = ' + JSON.stringify(fixtureModel, null, 2)); + if (!window.FixtureWrapper) { + window.FixtureWrapper = class FixtureWrapper extends PolymerElement { }; + customElements.define('fixture-wrapper', FixtureWrapper); + } + + if (fixtureModel) { + var f = document.querySelector('test-fixture[id=' + fixtureName + ']'); + var t = f.querySelector('template[is=dom-template]'); + if (t) { + var instanceProps = {}; + var p; + for (p in fixtureModel) { + instanceProps[p] = true; + } + var self = new FixtureWrapper(); + t.__templatizeOwner = undefined; + t._ctor = templatize(t, self, { + instanceProps: instanceProps, + forwardHostProp: function(prop, value) { + if (self._instance) { + self._instance.forwardHostProp(prop, value); + } + } + }); + t.stamp = function (model) { + var _instance = new this._ctor(model); + return _instance.root; + }.bind(t); + } + } + var element = fixture(fixtureName, fixtureModel); + //console.log('setupFixture: name = ' + fixtureName + + // ' element.lang = ' + element.lang + + // ' getAttribute("lang") = ' + element.getAttribute('lang') + + // ' element._lang = ' + element._lang); + if (element) { + if (fixtureModel && + typeof fixtureModel.lang === 'string' && + fixtureModel.lang !== 'en' && + fixtureModel.lang !== element.effectiveLang && element.effectiveLang !== 'en') { + //console.log('setupFixture: waiting for lang-updated'); + element.addEventListener('lang-updated', function setupFixtureLangUpdated (event) { + //console.log('setupFixtureLangUpdated'); + if (event.target === element && + element.effectiveLang === fixtureModel.lang) { + //console.log('setupFixtureLangUpdated lang = ' + event.detail.lang + ' effectiveLang = ' + element.effectiveLang); + element.removeEventListener('lang-updated', setupFixtureLangUpdated); + resolve(element); + } + }); + } + else { + //console.log('setupFixture: element ready without lang-updated'); + setTimeout(function () { + if (params.lang === '' || params.lang === 'en') { + element.fire('lang-updated'); + } + }, 500); + resolve(element); + } + } + else { + reject(new Error('setupFixture returns null for ' + + fixtureName + ' ' + JSON.stringify(fixtureModel,null,2))); + } + }); + } +} + +window.restoreFixture = function restoreFixture (fixtureName) { + var e = document.querySelector('#' + fixtureName); + if (!e) { + throw new Error('Fixture element with id = ' + fixtureName + ' not found'); + } + if (e.is === 'i18n-dom-bind') { + if (e._intervalId) { + clearInterval(e._intervalId); + } + Array.prototype.forEach.call(document.querySelectorAll('i18n-dom-bind'), + function (node) { + node.observeHtmlLang = true; + } + ); + } + else { + teardownFakeServer(e); + e.restore(); + } +} + +window.getLocalDomRoot = function getLocalDomRoot (e) { + if (e.is === 'i18n-dom-bind') { + return e.parentElement; + } + else if (e) { + return e.root; + } + else { + return null; + } +} + +window.suitesRunner = function suitesRunner (suites, _wait) { + + suites.forEach(function (params) { + + suite(params.suite, function () { + var el; + var p; + var n; + var i, j; + var expected; + var results; + var node; + var rawValue = params.rawValue; + var fixtureElement; + var noProperties; + var lang = params.assign && params.assign.lang ? params.assign.lang : 'en'; + var event = params.event ? params.event : 'lang-updated'; + var defTimeout = 300000; + var timeout = params.timeout ? (params.timeout < defTimeout ? defTimeout : params.timeout) : defTimeout; + this.timeout(timeout); + + (params.setup ? setup : suiteSetup)(function () { + return (_wait ? new Promise((resolve) => { setTimeout(() => { resolve(); }, _wait); }) : Promise.resolve()).then(() => setupFixture(params, params.fixtureModel)) + .then(function (element) { + el = element; + //console.log('setup: element.lang = ' + element.lang); + return new Promise(function (resolve, reject) { + //console.log(params.suite, 'waiting for ' + event); + if (params && + (params.event || + params.assign && (params.assign.lang || params.assign['html.lang']))) { + el.addEventListener(event, function fixtureSetup (e) { + if (el === dom(e).rootTarget && + el.lang === params.lang && + el.effectiveLang === params.effectiveLang) { + el.removeEventListener(event, fixtureSetup); + //console.log('setup: updateProperty resolving on ' + event); + resolve(el); + } + else { + console.log(params.suite + ' skipping uninteresting event ' + event + + ' "' + el.lang + '" "' + params.lang + '" "' + el.effectiveLang + '" "' + params.effectiveLang + '"'); + } + }); + //console.log('setup: updateProperty ' + JSON.stringify(params.assign, null, 2)); + updateProperty(el, params.assign); + } + else { + //console.log('setup: updateProperty ' + JSON.stringify(params.assign, null, 2)); + //console.log('setup: updateProperty resolving without ' + event); + updateProperty(el, params.assign); + resolve(el); + } + }); + }, function (error) { + throw new Error(error); + }) + .then((result) => { + if (_wait) { + return new Promise((resolve) => { setTimeout(() => resolve(result), _wait); }); + } + else { + return result; + } + }); + }); + + test('{lang, effectiveLang, templateDefaultLang, observeHtmlLang' + + (params.text ? ', text' : '') + + (params.model ? ', model' : '') + + (params.localDOM ? ', local DOM' : '') + + '} properties are set as {' + + (isSuppressingSuiteParams ? '' : + [ params.lang, params.effectiveLang, params.templateDefaultLang, params.observeHtmlLang].join(', ') + + (params.text ? ', ' + JSON.stringify(params.text, null, 2) : '') + + (params.model ? ', ' + JSON.stringify(params.model, null, 2) : '') + + (!params.setup && params.localDOM ? ', ' + JSON.stringify(params.localDOM, null, 2) : '')) + + '}' + + (params.assign && params.assign.lang ? ' for ' + params.assign.lang : ''), function () { + assert.isString(el.lang, 'lang property is a string'); + assert.equal(el.lang, params.lang, 'lang property is set'); + assert.isString(el.effectiveLang, 'effectiveLang property is a string'); + assert.equal(el.effectiveLang, params.effectiveLang, 'effectiveLang property is set'); + assert.isString(el.templateDefaultLang, 'templateDefaultLang property is a string'); + assert.equal(el.templateDefaultLang, params.templateDefaultLang, 'templateDefaultLang property is set'); + assert.isBoolean(el.observeHtmlLang, 'observeHtmlLang property is a Boolean'); + assert.equal(el.observeHtmlLang, params.observeHtmlLang, 'observeHtmlLang property is set'); + if (params.text) { + var actual; + expected = deepMap(deepcopy(params.text), params.text, minifyText); + actual = deepMap(deepcopy(el.text), el.text, minifyText); + noProperties = true; + assert.isObject(el.text, 'text property is an object'); + //console.log(JSON.stringify(e.detail, null, 2)); + //console.log(JSON.stringify(el.text, null, 2)); + for (p in expected) { + if (p === 'meta') { + continue; + } + noProperties = false; + assert.deepEqual(actual[p], + params.rawText ? expected[p] : translate(params.effectiveLang, null, expected[p]), + 'text.' + p + ' property is set for ' + params.effectiveLang); + } + if (noProperties) { + assert.deepEqual(deepMap(deepcopy(el.text), el.text, minifyText), + expected, + 'text property is set'); + } + } + if (params.model) { + noProperties = true; + assert.isObject(el.model, 'model property is an object'); + for (p in expected) { + noProperties = false; + //console.log('model.' + p + ' = ' + JSON.stringify(el.model[p])); + //console.log('expected model.' + p + ' = ' + JSON.stringify(translate(el.effectiveLang, null, params.model[p]))); + assert.deepEqual(minifyText(el.model[p]), + params.rawText ? params.model[p] : translate(params.effectiveLang, null, params.model[p]), + 'model.' + p + ' property is set for ' + params.effectiveLang); + } + if (noProperties) { + assert.deepEqual(el.model, params.model, 'model property is set'); + } + } + if (!params.setup && params.localDOM) { + params.localDOM.forEach(function (childPath) { + var completeStatus; + var nodes = dom(getLocalDomRoot(el)).querySelectorAll(childPath.select); + assert.ok(nodes.length > 0, childPath.select + ' is defined'); + for (var p in childPath) { + if (p === 'select') { + continue; + } + //console.log(p + ' is set as ' + childPath[p]); + if (Array.isArray(childPath[p])) { + //console.log(nodes); + Array.prototype.forEach.call(childPath[p], function (path, i, a) { + assert.equal(minifyText(getProperty(nodes[i], p)), + minifyText(params.rawText ? path : translate(params.effectiveLang, p, path)), + p + ' is set as ' + minifyText(params.rawText ? path : translate(params.effectiveLang, p, path))); + }); + } + else { + //console.log(nodes[0]); + assert.equal(minifyText(getProperty(nodes[0], p)), + minifyText(params.rawText ? childPath[p] : translate(params.effectiveLang, p, childPath[p])), + p + ' is set as ' + translate(params.rawText ? childPath[p] : params.effectiveLang, p, childPath[p])); + } + } + //console.log(childPath); + }); + } + }); + +/* + if (params.text) { + test('text' + ' property is set as ' + JSON.stringify(params.text,null,2) + + (params.assign && params.assign.lang ? ' for ' + params.assign.lang : ''), function () { + expected = deepMap(deepcopy(params.text), params.text, minifyText); + noProperties = true; + assert.isObject(el.text, 'text property is an object'); + //console.log(JSON.stringify(e.detail, null, 2)); + //console.log(JSON.stringify(el.text, null, 2)); + for (p in expected) { + noProperties = false; + assert.deepEqual(deepMap(deepcopy(el.text[p]), el.text[p], minifyText), + params.rawText ? expected[p] : translate(params.effectiveLang, null, expected[p]), + 'text.' + p + ' property is set for ' + params.effectiveLang); + } + if (noProperties) { + assert.deepEqual(deepMap(deepcopy(el.text), el.text, minifyText), + expected, + 'text property is set'); + } + }); + } + + if (params.model) { + test('model' + ' property is set as ' + JSON.stringify(params.model,null,2) + + (params.assign && params.assign.lang ? ' for ' + params.assign.lang : ''), function () { + noProperties = true; + assert.isObject(el.model, 'model property is an object'); + for (p in params.model) { + noProperties = false; + //console.log('model.' + p + ' = ' + JSON.stringify(el.model[p])); + //console.log('expected model.' + p + ' = ' + JSON.stringify(translate(el.effectiveLang, null, params.model[p]))); + assert.deepEqual(el.model[p], + params.rawText ? params.model[p] : translate(params.effectiveLang, null, params.model[p]), + 'model.' + p + ' property is set for ' + params.effectiveLang); + } + if (noProperties) { + assert.deepEqual(el.model, params.model, 'model property is set'); + } + }); + } +*/ + + if (params.setup && params.localDOM) { + test('local DOM ' + (isSuppressingSuiteParams ? '{}' : JSON.stringify(params.localDOM, null, 2)) + ' is set' + + (params.assign && params.assign.lang ? ' for ' + params.assign.lang : ''), function () { + params.localDOM.forEach(function (childPath) { + var completeStatus; + var nodes = dom(getLocalDomRoot(el)).querySelectorAll(childPath.select); + assert.ok(nodes.length > 0, childPath.select + ' is defined'); + for (var p in childPath) { + if (p === 'select') { + continue; + } + //console.log(p + ' is set as ' + childPath[p]); + if (Array.isArray(childPath[p])) { + //console.log(nodes); + Array.prototype.forEach.call(childPath[p], function (path, i, a) { + assert.equal(minifyText(getProperty(nodes[i], p)), + minifyText(params.rawText ? path : translate(params.effectiveLang, p, path)), + p + ' is set as ' + minifyText(params.rawText ? path : translate(params.effectiveLang, p, path))); + }); + } + else { + //console.log(nodes[0]); + assert.equal(minifyText(getProperty(nodes[0], p)), + minifyText(params.rawText ? childPath[p] : translate(params.effectiveLang, p, childPath[p])), + p + ' is set as ' + translate(params.rawText ? childPath[p] : params.effectiveLang, p, childPath[p])); + } + } + //console.log(childPath); + }); + }); + } + + if (params.lightDOM) { + test('light DOM ' + (isSuppressingSuiteParams ? '{}' : JSON.stringify(params.lightDOM, null, 2)) + ' is set' + + (params.assign && params.assign.lang ? ' for ' + params.assign.lang : ''), function () { + params.lightDOM.forEach(function (childPath) { + var completeStatus; + var nodes = dom(el).querySelectorAll(childPath.select); + assert.ok(nodes.length > 0, childPath.select + ' is defined'); + for (var p in childPath) { + if (p === 'select') { + continue; + } + //console.log(p + ' is set as ' + childPath[p]); + if (Array.isArray(childPath[p])) { + //console.log(nodes); + Array.prototype.forEach.call(childPath[p], function (path, i, a) { + assert.equal(getProperty(nodes[i], p), translate(params.effectiveLang, p, path), p + ' is set as ' + translate(params.effectiveLang, p, path)); + }); + } + else { + //console.log(nodes[0]); + assert.equal(getProperty(nodes[0], p), translate(params.effectiveLang, p, childPath[p]), p + ' is set as ' + translate(params.effectiveLang, p, childPath[p])); + } + } + //console.log(childPath); + }); + }); + } + + (params.setup ? teardown : suiteTeardown)(function () { + restoreFixture(params.fixture); + }); + }); + }); +} diff --git a/test/src3/basic-test-dom-bind-dummy.html b/test/src3/basic-test-dom-bind-dummy.html new file mode 100755 index 00000000..e8ca220b --- /dev/null +++ b/test/src3/basic-test-dom-bind-dummy.html @@ -0,0 +1,315 @@ + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ + + diff --git a/test/tmp/basic-test-dom-bind-dummy.html b/test/tmp/basic-test-dom-bind-dummy.html new file mode 100644 index 00000000..24d5f18d --- /dev/null +++ b/test/tmp/basic-test-dom-bind-dummy.html @@ -0,0 +1,570 @@ + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ + + + \ No newline at end of file diff --git a/test/tmp/basic-test.html b/test/tmp/basic-test.html new file mode 100644 index 00000000..22c8c587 --- /dev/null +++ b/test/tmp/basic-test.html @@ -0,0 +1,303 @@ + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/tmp/commented-simple-text-element/commented-simple-text-element.html b/test/tmp/commented-simple-text-element/commented-simple-text-element.html new file mode 100644 index 00000000..c050254a --- /dev/null +++ b/test/tmp/commented-simple-text-element/commented-simple-text-element.html @@ -0,0 +1,173 @@ +CjwhLS0gY29tbWVudCAtLT4KICAgIG91dGVybW9zdCB0ZXh0IGF0IHRoZSBiZWdpbm5pbmcgPCEtLSBjb21tZW50IC0tPgogICAgPGRpdj48ZGl2PjwvZGl2PjwvZGl2PjwhLS0gbmVzdGVkIGVtcHR5IGRpdiAtLT4KICAgIDxzcGFuIGlkPSJ3aGl0ZXNwYWNlIj4gJm5ic3A7IDwhLS0gY29tbWVudCAtLT48L3NwYW4+PCEtLSBjb21tZW50IC0tPgogICAgPGgxPm91dGVybW9zdCBoZWFkZXIgMTwhLS0gY29tbWVudCAtLT48L2gxPjwhLS0gY29tbWVudCAtLT4KICAgIG91dGVybW9zdCB0ZXh0IGluIHRoZSBtaWRkbGUgPCEtLSBjb21tZW50IC0tPgogICAgPHNwYW4+c2ltcGxlIHRleHQgd2l0aG91dCBpZDwhLS0gY29tbWVudCAtLT48L3NwYW4+PCEtLSBjb21tZW50IC0tPgogICAgPHNwYW4+c2ltcGxlIHRleHQgd2l0aG91dCBpZCAyPCEtLSBjb21tZW50IC0tPjwvc3Bhbj48IS0tIGNvbW1lbnQgLS0+CiAgICA8c3BhbiBpZD0ibGFiZWwtMSI+c2ltcGxlIHRleHQgd2l0aCBpZDwhLS0gY29tbWVudCAtLT48L3NwYW4+PCEtLSBjb21tZW50IC0tPgogICAgPHNwYW4gaWQ9ImxhYmVsLTIiPnNpbXBsZSB0ZXh0IHdpdGggaWQgMjwhLS0gY29tbWVudCAtLT48L3NwYW4+PCEtLSBjb21tZW50IC0tPgogICAgPGRpdj4KICAgICAgPHNwYW4+PCEtLSBjb21tZW50IC0tPnNpbXBsZSB0ZXh0IHdpdGhpbiBkaXY8IS0tIGNvbW1lbnQgLS0+PC9zcGFuPiA8IS0tIGNvbW1lbnQgLS0+CiAgICAgIDxzcGFuPjwhLS0gY29tbWVudCAtLT5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2IDI8IS0tIGNvbW1lbnQgLS0+PC9zcGFuPiA8IS0tIGNvbW1lbnQgLS0+CiAgICAgIDxkaXY+PGRpdj5ncmVhdCBncmFuZGNoaWxkIHRleHQgd2l0aGluIGRpdjwvZGl2PjwhLS0gY29tbWVudCAtLT48L2Rpdj4gPCEtLSBjb21tZW50IC0tPgogICAgPC9kaXY+CiAgICA8IS0tIGNvbW1lbnQgLS0+CiAgICA8ZGl2PgogICAgICBzaW1wbGUgdGV4dCBhcyB0aGUgZmlyc3QgZWxlbWVudCBpbiBkaXYgPCEtLSBjb21tZW50IC0tPgogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2PCEtLSBjb21tZW50IC0tPjwvc3Bhbj48IS0tIGNvbW1lbnQgLS0+CiAgICAgIHNpbXBsZSB0ZXh0IGluIHRoZSBtaWRkbGUgb2YgZGl2IDwhLS0gY29tbWVudCAtLT4KICAgICAgPHNwYW4+c2ltcGxlIHRleHQgd2l0aGluIGRpdiAyPC9zcGFuPjwhLS0gY29tbWVudCAtLT4KICAgICAgPGRpdj48ZGl2PmdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2PC9kaXY+PCEtLSBjb21tZW50IC0tPjwvZGl2PjwhLS0gY29tbWVudCAtLT4KICAgICAgc2ltcGxlIHRleHQgYXQgdGhlIGxhc3QgZWxlbWVudCBpbiBkaXYKICAgIDwvZGl2PjwhLS0gY29tbWVudCAtLT4KICAgIDxkaXYgaWQ9InRvcGxldmVsLWRpdiI+PCEtLSBjb21tZW50IC0tPgogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2PC9zcGFuPjwhLS0gY29tbWVudCAtLT4KICAgICAgPHNwYW4+c2ltcGxlIHRleHQgd2l0aGluIGRpdiAyPC9zcGFuPjwhLS0gY29tbWVudCAtLT4KICAgICAgPGRpdiBpZD0ic2Vjb25kLWxldmVsLWRpdiI+PCEtLSBjb21tZW50IC0tPgogICAgICAgIDxkaXYgaWQ9InRoaXJkLWxldmVsLWRpdiI+Z3JlYXQgZ3JhbmRjaGlsZCB0ZXh0IHdpdGhpbiBkaXY8IS0tIGNvbW1lbnQgLS0+PC9kaXY+CiAgICAgICAgPGRpdj5ncmVhdCBncmFuZGNoaWxkIHRleHQgd2l0aGluIGRpdiB3aXRob3V0IGlkPC9kaXY+PCEtLSBjb21tZW50IC0tPgogICAgICA8L2Rpdj4KICAgIDwvZGl2PgogICAgPGRpdj4KICAgICAgPHVsPjwhLS0gY29tbWVudCAtLT4KICAgICAgICA8bGk+bGluZSBpdGVtIHdpdGhvdXQgaWQgMTwvbGk+PCEtLSBjb21tZW50IC0tPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aG91dCBpZCAyPC9saT48IS0tIGNvbW1lbnQgLS0+CiAgICAgICAgPGxpPmxpbmUgaXRlbSB3aXRob3V0IGlkIDM8L2xpPjwhLS0gY29tbWVudCAtLT4KICAgICAgPC91bD48IS0tIGNvbW1lbnQgLS0+CiAgICAgIDx1bCBpZD0ibGluZS1pdGVtcyI+PCEtLSBjb21tZW50IC0tPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aCBpZCAxPCEtLSBjb21tZW50IC0tPjwvbGk+CiAgICAgICAgPGxpPmxpbmUgaXRlbSB3aXRoIGlkIDI8IS0tIGNvbW1lbnQgLS0+PC9saT4KICAgICAgICA8bGk+bGluZSBpdGVtIHdpdGggaWQgMzwhLS0gY29tbWVudCAtLT48L2xpPgogICAgICA8L3VsPjwhLS0gY29tbWVudCAtLT4KICAgIDwvZGl2PjwhLS0gY29tbWVudCAtLT4KICAgIDxwPjwhLS0gY29tbWVudCAtLT5BIHBhcmFncmFwaCB3aXRoIDwhLS0gY29tbWVudCAtLT48Yj5wYXJhbWV0ZXJzPC9iPjwhLS0gY29tbWVudCAtLT4gaXMgY29udmVydGVkIHRvIDwhLS0gY29tbWVudCAtLT48Y29kZT4mbHQ7aTE4bi1mb3JtYXQmZ3Q7PC9jb2RlPjwhLS0gY29tbWVudCAtLT4uPCEtLSBjb21tZW50IC0tPjwvcD48IS0tIGNvbW1lbnQgLS0+CiAgICA8cCBpZD0icGFyYWdyYXBoIj48IS0tIGNvbW1lbnQgLS0+QSBwYXJhZ3JhcGggd2l0aCA8IS0tIGNvbW1lbnQgLS0+PGI+aWQ8L2I+PCEtLSBjb21tZW50IC0tPiBpcyBjb252ZXJ0ZWQgdG8gPCEtLSBjb21tZW50IC0tPjxjb2RlPiZsdDtpMThuLWZvcm1hdCZndDs8L2NvZGU+PCEtLSBjb21tZW50IC0tPi48IS0tIGNvbW1lbnQgLS0+PC9wPgogICAgb3V0ZXJtb3N0IHRleHQgYXQgdGhlIGVuZCA8IS0tIGNvbW1lbnQgLS0+Cg== + \ No newline at end of file diff --git a/test/tmp/commented-simple-text-element/commented-simple-text-element.json b/test/tmp/commented-simple-text-element/commented-simple-text-element.json new file mode 100644 index 00000000..f9b2ccf7 --- /dev/null +++ b/test/tmp/commented-simple-text-element/commented-simple-text-element.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "model": {}, + "text": " outermost text at the beginning ", + "h1_3": "outermost header 1", + "text_4": " outermost text in the middle ", + "span_5": "simple text without id", + "span_6": "simple text without id 2", + "label-1": "simple text with id", + "label-2": "simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "simple text within div", + "toplevel-div:span_1": "simple text within div 2", + "third-level-div": "great grandchild text within div", + "second-level-div:div_1": "great grandchild text within div without id", + "div_12:ul:li": "line item without id 1", + "div_12:ul:li_1": "line item without id 2", + "div_12:ul:li_2": "line item without id 3", + "line-items:li": "line item with id 1", + "line-items:li_1": "line item with id 2", + "line-items:li_2": "line item with id 3", + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "parameters", + "" + ], + "paragraph": [ + "A paragraph with {1} is converted to {2}.", + "id", + "" + ], + "text_15": " outermost text at the end " +} \ No newline at end of file diff --git a/test/tmp/compound-binding-dom-bind.json b/test/tmp/compound-binding-dom-bind.json new file mode 100644 index 00000000..87338aff --- /dev/null +++ b/test/tmp/compound-binding-dom-bind.json @@ -0,0 +1,151 @@ +{ + "meta": {}, + "model": {}, + "text": [ + " outermost text at the beginning with compound {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "h1_3": [ + "outermost header 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "text_4": [ + " outermost text in the middle with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "span_5": [ + "simple text without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "span_6": [ + "simple text without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-1": [ + "simple text with id and {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-2": [ + "simple text with id and {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:span": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_9:span_1": [ + "simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:div_2:div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text": [ + " simple text as the first element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_1": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_2": [ + " simple text in the middle of div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_3": [ + "simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_10:div_4:div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_5": [ + " simple text at the last element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span_1": [ + "simple text within div 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "third-level-div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "second-level-div:div_1": [ + "great grandchild text within div without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li": [ + "line item without id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_1": [ + "line item without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_2": [ + "line item without id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li": [ + "line item with id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_1": [ + "line item with id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_2": [ + "line item with id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "{{param1}}", + "{{param2}}" + ], + "paragraph": [ + "A paragraph with {1}, {2}, and {3} is converted to {4}.", + "id", + "{{param1}}", + "{{param2}}", + "" + ], + "text_15": [ + " outermost text at the end with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ] +} \ No newline at end of file diff --git a/test/tmp/compound-binding-element/compound-binding-element.html b/test/tmp/compound-binding-element/compound-binding-element.html new file mode 100644 index 00000000..529a6ac4 --- /dev/null +++ b/test/tmp/compound-binding-element/compound-binding-element.html @@ -0,0 +1,380 @@ +CiAgICBvdXRlcm1vc3QgdGV4dCBhdCB0aGUgYmVnaW5uaW5nIHdpdGggY29tcG91bmQge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXMKICAgIDxkaXY+PGRpdj48L2Rpdj48L2Rpdj48IS0tIG5lc3RlZCBlbXB0eSBkaXYgLS0+CiAgICA8c3BhbiBpZD0id2hpdGVzcGFjZSI+ICZuYnNwOyA8L3NwYW4+CiAgICA8aDE+b3V0ZXJtb3N0IGhlYWRlciAxIHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXM8L2gxPgogICAgb3V0ZXJtb3N0IHRleHQgaW4gdGhlIG1pZGRsZSB3aXRoIHt7cGFyYW0xfX0gYW5kIHt7cGFyYW0yfX0gdmFyaWFibGVzCiAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRob3V0IGlkIHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXM8L3NwYW4+CiAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRob3V0IGlkIDIgd2l0aCB7e3BhcmFtMX19IGFuZCB7e3BhcmFtMn19IHZhcmlhYmxlczwvc3Bhbj4KICAgIDxzcGFuIGlkPSJsYWJlbC0xIj5zaW1wbGUgdGV4dCB3aXRoIGlkIGFuZCB7e3BhcmFtMX19IGFuZCB7e3BhcmFtMn19IHZhcmlhYmxlczwvc3Bhbj4KICAgIDxzcGFuIGlkPSJsYWJlbC0yIj5zaW1wbGUgdGV4dCB3aXRoIGlkIGFuZCB7e3BhcmFtMX19IGFuZCB7e3BhcmFtMn19IHZhcmlhYmxlcyAyPC9zcGFuPgogICAgPGRpdj4KICAgICAgPHNwYW4+c2ltcGxlIHRleHQgd2l0aGluIGRpdiB3aXRoIHt7cGFyYW0xfX0gYW5kIHt7cGFyYW0yfX0gdmFyaWFibGVzPC9zcGFuPiAKICAgICAgPHNwYW4+c2ltcGxlIHRleHQgd2l0aGluIGRpdiB3aXRoIHt7cGFyYW0xfX0gYW5kIHt7cGFyYW0yfX0gdmFyaWFibGVzIDI8L3NwYW4+IAogICAgICA8ZGl2PjxkaXY+Z3JlYXQgZ3JhbmRjaGlsZCB0ZXh0IHdpdGhpbiBkaXYgd2l0aCB7e3BhcmFtMX19IGFuZCB7e3BhcmFtMn19IHZhcmlhYmxlczwvZGl2PjwvZGl2PiAKICAgIDwvZGl2PgogICAgPGRpdj4KICAgICAgc2ltcGxlIHRleHQgYXMgdGhlIGZpcnN0IGVsZW1lbnQgaW4gZGl2IHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXMKICAgICAgPHNwYW4+c2ltcGxlIHRleHQgd2l0aGluIGRpdiB3aXRoIHt7cGFyYW0xfX0gYW5kIHt7cGFyYW0yfX0gdmFyaWFibGVzPC9zcGFuPgogICAgICBzaW1wbGUgdGV4dCBpbiB0aGUgbWlkZGxlIG9mIGRpdiB3aXRoIHt7cGFyYW0xfX0gYW5kIHt7cGFyYW0yfX0gdmFyaWFibGVzIAogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2IHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXMgMjwvc3Bhbj4KICAgICAgPGRpdj48ZGl2PmdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2IHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXM8L2Rpdj48L2Rpdj4KICAgICAgc2ltcGxlIHRleHQgYXQgdGhlIGxhc3QgZWxlbWVudCBpbiBkaXYgd2l0aCB7e3BhcmFtMX19IGFuZCB7e3BhcmFtMn19IHZhcmlhYmxlcwogICAgPC9kaXY+CiAgICA8ZGl2IGlkPSJ0b3BsZXZlbC1kaXYiPgogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2IHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXM8L3NwYW4+CiAgICAgIDxzcGFuPnNpbXBsZSB0ZXh0IHdpdGhpbiBkaXYgMiB3aXRoIHt7cGFyYW0xfX0gYW5kIHt7cGFyYW0yfX0gdmFyaWFibGVzPC9zcGFuPgogICAgICA8ZGl2IGlkPSJzZWNvbmQtbGV2ZWwtZGl2Ij4KICAgICAgICA8ZGl2IGlkPSJ0aGlyZC1sZXZlbC1kaXYiPmdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2IHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXM8L2Rpdj4KICAgICAgICA8ZGl2PmdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2IHdpdGhvdXQgaWQgd2l0aCB7e3BhcmFtMX19IGFuZCB7e3BhcmFtMn19IHZhcmlhYmxlczwvZGl2PgogICAgICA8L2Rpdj4KICAgIDwvZGl2PgogICAgPGRpdj4KICAgICAgPHVsPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aG91dCBpZCAxIHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXM8L2xpPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aG91dCBpZCAyIHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXM8L2xpPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aG91dCBpZCAzIHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXM8L2xpPgogICAgICA8L3VsPgogICAgICA8dWwgaWQ9ImxpbmUtaXRlbXMiPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aCBpZCAxIHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXM8L2xpPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aCBpZCAyIHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXM8L2xpPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aCBpZCAzIHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXM8L2xpPgogICAgICA8L3VsPgogICAgPC9kaXY+CiAgICA8cD5BIHBhcmFncmFwaCB3aXRoIHt7cGFyYW0xfX0gaXMgY29udmVydGVkIHRvIHt7cGFyYW0yfX0uPC9wPgogICAgPHAgaWQ9InBhcmFncmFwaCI+QSBwYXJhZ3JhcGggd2l0aCA8Yj5pZDwvYj4sIHt7cGFyYW0xfX0sIGFuZCB7e3BhcmFtMn19IGlzIGNvbnZlcnRlZCB0byA8Y29kZT4mbHQ7aTE4bi1mb3JtYXQmZ3Q7PC9jb2RlPi48L3A+CiAgICBvdXRlcm1vc3QgdGV4dCBhdCB0aGUgZW5kIHdpdGgge3twYXJhbTF9fSBhbmQge3twYXJhbTJ9fSB2YXJpYWJsZXMK + \ No newline at end of file diff --git a/test/tmp/compound-binding-element/compound-binding-element.json b/test/tmp/compound-binding-element/compound-binding-element.json new file mode 100644 index 00000000..87338aff --- /dev/null +++ b/test/tmp/compound-binding-element/compound-binding-element.json @@ -0,0 +1,151 @@ +{ + "meta": {}, + "model": {}, + "text": [ + " outermost text at the beginning with compound {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "h1_3": [ + "outermost header 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "text_4": [ + " outermost text in the middle with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "span_5": [ + "simple text without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "span_6": [ + "simple text without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-1": [ + "simple text with id and {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-2": [ + "simple text with id and {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:span": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_9:span_1": [ + "simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:div_2:div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text": [ + " simple text as the first element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_1": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_2": [ + " simple text in the middle of div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_3": [ + "simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_10:div_4:div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_5": [ + " simple text at the last element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span_1": [ + "simple text within div 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "third-level-div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "second-level-div:div_1": [ + "great grandchild text within div without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li": [ + "line item without id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_1": [ + "line item without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_2": [ + "line item without id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li": [ + "line item with id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_1": [ + "line item with id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_2": [ + "line item with id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "{{param1}}", + "{{param2}}" + ], + "paragraph": [ + "A paragraph with {1}, {2}, and {3} is converted to {4}.", + "id", + "{{param1}}", + "{{param2}}", + "" + ], + "text_15": [ + " outermost text at the end with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ] +} \ No newline at end of file diff --git a/test/tmp/edge-case-dom-bind.json b/test/tmp/edge-case-dom-bind.json new file mode 100644 index 00000000..4577c44d --- /dev/null +++ b/test/tmp/edge-case-dom-bind.json @@ -0,0 +1,29 @@ +{ + "meta": {}, + "model": {}, + "text": [ + " name = {1} ", + "{{text.name}}" + ], + "i18n-number_1": "1", + "i18n-format_2": [ + "{{text.format}}", + "1" + ], + "i18n-format_3": [ + "format", + "" + ], + "p_8": [ + "hello {1}{2} {3} world", + "
", + "", + "" + ], + "p_9": [ + "hello{1}world", + "
" + ], + "text_10": " hello ", + "text_14": " world " +} \ No newline at end of file diff --git a/test/tmp/edge-case-test.html b/test/tmp/edge-case-test.html new file mode 100644 index 00000000..4c0c2e32 --- /dev/null +++ b/test/tmp/edge-case-test.html @@ -0,0 +1,121 @@ + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + \ No newline at end of file diff --git a/test/tmp/edge-case/advanced-binding-element.html b/test/tmp/edge-case/advanced-binding-element.html new file mode 100644 index 00000000..497ee80a --- /dev/null +++ b/test/tmp/edge-case/advanced-binding-element.html @@ -0,0 +1,126 @@ +CiAgICA8c3BhbiBpZD0ic3RhdHVzIj57e3RyKHN0YXR1cyx0ZXh0LnN0YXR1c01lc3NhZ2VzKX19PC9zcGFuPgoKICAgIDxzcGFuIGlkPSJkZWZhdWx0Ij57e29yKHZhbHVlLHRleHQuZGVmYXVsdFZhbHVlKX19PC9zcGFuPgoKICAgIDxpMThuLWZvcm1hdCBpZD0iYW5ub3RhdGVkLWZvcm1hdCI+CiAgICAgIDxzcGFuPnt7dHIoc3RhdHVzLHRleHQuc3RhdHVzTWVzc2FnZUZvcm1hdHMpfX08L3NwYW4+CiAgICAgIDxzcGFuPnt7cGFyYW1ldGVyfX08L3NwYW4+CiAgICAgIDxzcGFuPnN0cmluZyBwYXJhbWV0ZXI8L3NwYW4+CiAgICA8L2kxOG4tZm9ybWF0PgoKICAgIDxpbnB1dCBpcz0iaXJvbi1pbnB1dCIgaWQ9ImFyaWEtYXR0cmlidXRlcyIgdGl0bGU9InRvb2x0aXAgdGV4dCIgYXJpYS1sYWJlbD0iYXJpYSBsYWJlbCB0ZXh0IiBhcmlhLXZhbHVldGV4dD0iYXJpYSB2YWx1ZSB0ZXh0IiBiaW5kLXZhbHVlPSJ7e3ZhbHVlfX0iPgoKICAgIDxzcGFuPnt7dHIoJ2tleScsdGV4dC5ub2RlZmF1bHQpfX08L3NwYW4+CiAgICA8c3Bhbj57e3RleHQuZGVmYXVsdFZhbHVlfX0ge3t0ZXh0LmRlZmF1bHRWYWx1ZX19PC9zcGFuPgoKICAgIDx0ZW1wbGF0ZT4KICAgICAgPGpzb24tZGF0YSB0ZXh0LWlkPSJzdGF0dXNNZXNzYWdlcyI+ewogICAgICAgICJvayI6ICJoZWFsdGh5IHN0YXR1cyIsCiAgICAgICAgImJ1c3kiOiAiYnVzeSBzdGF0dXMiLAogICAgICAgICJlcnJvciI6ICJlcnJvciBzdGF0dXMiLAogICAgICAgICJkZWZhdWx0IjogInVua25vd24gc3RhdHVzIgogICAgICB9PC9qc29uLWRhdGE+CiAgICAgIDxzcGFuIHRleHQtaWQ9ImRlZmF1bHRWYWx1ZSI+ZGVmYXVsdCB2YWx1ZTwvc3Bhbj4KICAgICAgPGpzb24tZGF0YSB0ZXh0LWlkPSJzdGF0dXNNZXNzYWdlRm9ybWF0cyI+ewogICAgICAgICJvayI6ICJoZWFsdGh5IHN0YXR1cyIsCiAgICAgICAgImJ1c3kiOiAiYnVzeSBzdGF0dXMgd2l0aCB7Mn0iLAogICAgICAgICJlcnJvciI6ICJlcnJvciBzdGF0dXMgd2l0aCB7MX0gYW5kIHsyfSIsCiAgICAgICAgImRlZmF1bHQiOiAidW5rbm93biBzdGF0dXMiCiAgICAgIH08L2pzb24tZGF0YT4KICAgICAgPGpzb24tZGF0YSB0ZXh0LWlkPSJub2RlZmF1bHQiPnsKICAgICAgICAib2siOiAib2sgc3RhdHVzIgogICAgICB9PC9qc29uLWRhdGE+CiAgICA8L3RlbXBsYXRlPgo= + \ No newline at end of file diff --git a/test/tmp/edge-case/advanced-binding-element.json b/test/tmp/edge-case/advanced-binding-element.json new file mode 100644 index 00000000..d9510d4c --- /dev/null +++ b/test/tmp/edge-case/advanced-binding-element.json @@ -0,0 +1,36 @@ +{ + "meta": {}, + "model": { + "aria-attributes": { + "title": "tooltip text", + "aria-label": "aria label text", + "aria-valuetext": "aria value text" + } + }, + "annotated-format": [ + "{{tr(status,text.statusMessageFormats)}}", + "{{parameter}}", + "string parameter" + ], + "span_5": [ + "{1} {2}", + "{{text.defaultValue}}", + "{{text.defaultValue}}" + ], + "statusMessages": { + "ok": "healthy status", + "busy": "busy status", + "error": "error status", + "default": "unknown status" + }, + "defaultValue": "default value", + "statusMessageFormats": { + "ok": "healthy status", + "busy": "busy status with {2}", + "error": "error status with {1} and {2}", + "default": "unknown status" + }, + "nodefault": { + "ok": "ok status" + } +} \ No newline at end of file diff --git a/test/tmp/edge-case/complex-compound-binding-element.html b/test/tmp/edge-case/complex-compound-binding-element.html new file mode 100644 index 00000000..f72fbf13 --- /dev/null +++ b/test/tmp/edge-case/complex-compound-binding-element.html @@ -0,0 +1,236 @@ +CiAgICA8aDUgaWQ9Iml0ZW0tdXBkYXRlMiI+dXBkYXRlZDoge3t0ZXh0LnVwZGF0ZWR9fSwgYnk6IAogICAgICA8ZG9tLXJlcGVhdCBpdGVtcz0ie3t0ZXh0LmF1dGhvcnN9fSI+PHRlbXBsYXRlPgogICAgICAgIHt7aXRlbS5uYW1lfX0KICAgICAgPC90ZW1wbGF0ZT48L2RvbS1yZXBlYXQ+CiAgICAgIHh4eAogICAgICA8ZG9tLWlmIGlmPSJ0cnVlIj48dGVtcGxhdGU+CiAgICAgICAgPHNwYW4+PGI+SUYgQ09OVEVOVDwvYj48L3NwYW4+CiAgICAgIDwvdGVtcGxhdGU+PC9kb20taWY+CiAgICAgIDxiPmFiYzwvYj4KICAgICAgPGRvbS1pZiBpZj0idHJ1ZSI+PHRlbXBsYXRlPklGIENPTlRFTlQgMjwvdGVtcGxhdGU+PC9kb20taWY+CiAgICAgIGhlbGxvCiAgICA8L2g1PgogICAgPGg1IGlkPSJpdGVtLXVwZGF0ZSI+dXBkYXRlZDoge3t0ZXh0LnVwZGF0ZWR9fSwgYnk6IAogICAgICA8ZG9tLXJlcGVhdCBpdGVtcz0ie3t0ZXh0LmF1dGhvcnN9fSI+PHRlbXBsYXRlPjwhLS0gY29tbWVudCBub2RlIC0tPgogICAgICAgIDxzcGFuPiAge3tpdGVtLm5hbWV9fSAgPC9zcGFuPgogICAgICA8L3RlbXBsYXRlPjwvZG9tLXJlcGVhdD4KICAgICAgeHh4CiAgICAgIDxkb20taWYgaWY9InRydWUiPjx0ZW1wbGF0ZT4KICAgICAgICA8Yj5JRiBDT05URU5UPC9iPgogICAgICA8L3RlbXBsYXRlPjwvZG9tLWlmPgogICAgICA8Yj5hYmM8L2I+CiAgICAgIDxkb20taWYgaWY9InRydWUiPjx0ZW1wbGF0ZT5JRiBDT05URU5UIDI8L3RlbXBsYXRlPjwvZG9tLWlmPgogICAgICBoZWxsbwogICAgICA8ZG9tLWlmIGlmPSJ0cnVlIj48dGVtcGxhdGU+PC90ZW1wbGF0ZT48L2RvbS1pZj4KICAgICAgPGRvbS1pZiBpZj0idHJ1ZSI+PHRlbXBsYXRlPiA8IS0tIGNvbW1lbnQgLS0+PC90ZW1wbGF0ZT48L2RvbS1pZj4KICAgICAgPGRvbS1pZiBpZj0idHJ1ZSI+PHRlbXBsYXRlPnt7dGV4dC51cGRhdGVkfX08L3RlbXBsYXRlPjwvZG9tLWlmPgogICAgPC9oNT4KICAgIDxoNSBpZD0iaXRlbS11cGRhdGUzIj51cGRhdGVkOiB7e3RleHQudXBkYXRlZH19LCBieTogCiAgICAgIDxkb20tcmVwZWF0IGl0ZW1zPSJ7e3RleHQuYXV0aG9yc319Ij48dGVtcGxhdGU+CiAgICAgICAge3tpdGVtLm5hbWV9fQogICAgICA8L3RlbXBsYXRlPjwvZG9tLXJlcGVhdD4KICAgICAgeHh4CiAgICAgIDxkb20taWYgaWY9InRydWUiPjx0ZW1wbGF0ZT4KICAgICAgICA8Yj5JRjwvYj48Yj5DT05URU5UPC9iPgogICAgICA8L3RlbXBsYXRlPjwvZG9tLWlmPgogICAgICA8Yj5hYmM8L2I+CiAgICAgIDxkb20taWYgaWY9InRydWUiPjx0ZW1wbGF0ZT5JRiBDT05URU5UIDI8L3RlbXBsYXRlPjwvZG9tLWlmPgogICAgICBoZWxsbwogICAgPC9oNT4KICAgIDxoNSBpZD0iaXRlbS11cGRhdGU0Ij51cGRhdGVkOiB7e3RleHQudXBkYXRlZH19LCBieTogCiAgICAgIDxkb20tcmVwZWF0IGl0ZW1zPSJ7e3RleHQuYXV0aG9yc319Ij48dGVtcGxhdGU+CiAgICAgICAge3tpdGVtLm5hbWV9fSA9IHt7dGV4dC51cGRhdGVkfX0KICAgICAgPC90ZW1wbGF0ZT48L2RvbS1yZXBlYXQ+CiAgICAgIHh4eAogICAgICA8ZG9tLWlmIGlmPSJ0cnVlIj48dGVtcGxhdGU+CiAgICAgICAgPGI+SUYgQ09OVEVOVDwvYj4KICAgICAgPC90ZW1wbGF0ZT48L2RvbS1pZj4KICAgICAgPGI+YWJjPC9iPgogICAgICA8ZG9tLWlmIGlmPSJ0cnVlIj48dGVtcGxhdGU+SUYgQ09OVEVOVCAyPC90ZW1wbGF0ZT48L2RvbS1pZj4KICAgICAgaGVsbG8KICAgIDwvaDU+CiAgICA8cCBpZD0icGFyYWdyYXBoIj5BIHBhcmFncmFwaCB3aXRoIAogICAgICA8ZG9tLXJlcGVhdCBpdGVtcz0ie3t0ZXh0LnBhcmFtZXRlcnN9fSI+PHRlbXBsYXRlPgogICAgICAgIDxpPnt7aXRlbX19IDwvaT4KICAgICAgPC90ZW1wbGF0ZT48L2RvbS1yZXBlYXQ+CiAgICAgIGlzIGNvbnZlcnRlZCB0byAKICAgICAgPGNvZGU+Jmx0O2kxOG4tZm9ybWF0Jmd0OzwvY29kZT4uCiAgICA8L3A+CiAgICA8cCBpZD0icGFyYWdyYXBoMiI+QSBwYXJhZ3JhcGggd2l0aCBkZWVwIAogICAgICA8ZG9tLXJlcGVhdCBpdGVtcz0ie3t0ZXh0LnBhcmFtZXRlcnN9fSI+PHRlbXBsYXRlPgogICAgICAgIDxzcGFuPjxpPnt7aXRlbX19PC9pPiA8L3NwYW4+CiAgICAgIDwvdGVtcGxhdGU+PC9kb20tcmVwZWF0PgogICAgICBpcyA8Yj5ub3Q8L2I+IGNvbnZlcnRlZCB0byAKICAgICAgPGNvZGU+Jmx0O2kxOG4tZm9ybWF0Jmd0OzwvY29kZT4uCiAgICAgIDxkb20taWYgaWY9ImZhbHNlIj48dGVtcGxhdGU+PC90ZW1wbGF0ZT48L2RvbS1pZj4KICAgICAgPGRvbS1pZiBpZj0iZmFsc2UiPjx0ZW1wbGF0ZT4gIDwvdGVtcGxhdGU+PC9kb20taWY+CiAgICAgIDxkb20taWYgaWY9ImZhbHNlIj48dGVtcGxhdGU+e3t0ZXh0LnVwZGF0ZWR9fTwvdGVtcGxhdGU+PC9kb20taWY+CiAgICA8L3A+CiAgICA8dGVtcGxhdGU+CiAgICAgIDxqc29uLWRhdGEgaWQ9ImF1dGhvcnMiPlsKICAgICAgICB7ICJuYW1lIjogIkpvZSIgfSwgeyAibmFtZSI6ICJBbGljZSIgfQogICAgICBdPC9qc29uLWRhdGE+CiAgICAgIDxzcGFuIGlkPSJ1cGRhdGVkIj5KYW4gMXN0LCAyMDE2PC9zcGFuPgogICAgICA8anNvbi1kYXRhIGlkPSJwYXJhbWV0ZXJzIj5bCiAgICAgICAgInBhcmFtZXRlciAxIiwgInBhcmFtZXRlciAyIgogICAgICBdPC9qc29uLWRhdGE+CiAgICA8L3RlbXBsYXRlPgo= + \ No newline at end of file diff --git a/test/tmp/edge-case/complex-compound-binding-element.json b/test/tmp/edge-case/complex-compound-binding-element.json new file mode 100644 index 00000000..7951181c --- /dev/null +++ b/test/tmp/edge-case/complex-compound-binding-element.json @@ -0,0 +1,69 @@ +{ + "meta": {}, + "model": {}, + "item-update2:text": [ + "updated: {1}, by: ", + "{{text.updated}}" + ], + "item-update2:text_2": " xxx ", + "item-update2:dom-if_3:template:span:b": "IF CONTENT", + "item-update2:b_4": "abc", + "item-update2:dom-if_5:template:text": "IF CONTENT 2", + "item-update2:text_6": " hello ", + "item-update:text": [ + "updated: {1}, by: ", + "{{text.updated}}" + ], + "item-update:text_2": " xxx ", + "item-update:dom-if_3:template:b": "IF CONTENT", + "item-update:b_4": "abc", + "item-update:dom-if_5:template:text": "IF CONTENT 2", + "item-update:text_6": " hello ", + "item-update3:text": [ + "updated: {1}, by: ", + "{{text.updated}}" + ], + "item-update3:text_2": " xxx ", + "item-update3:dom-if_3:template:b": "IF", + "item-update3:dom-if_3:template:b_1": "CONTENT", + "item-update3:b_4": "abc", + "item-update3:dom-if_5:template:text": "IF CONTENT 2", + "item-update3:text_6": " hello ", + "item-update4:text": [ + "updated: {1}, by: ", + "{{text.updated}}" + ], + "item-update4:dom-repeat_1:template:text": [ + " {1} = {2} ", + "{{item.name}}", + "{{text.updated}}" + ], + "item-update4:text_2": " xxx ", + "item-update4:dom-if_3:template:b": "IF CONTENT", + "item-update4:b_4": "abc", + "item-update4:dom-if_5:template:text": "IF CONTENT 2", + "item-update4:text_6": " hello ", + "paragraph:text": "A paragraph with ", + "paragraph:text_2": " is converted to ", + "paragraph:code_3": "", + "paragraph:text_4": ". ", + "paragraph2:text": "A paragraph with deep ", + "paragraph2:text_2": " is ", + "paragraph2:b_3": "not", + "paragraph2:text_4": " converted to ", + "paragraph2:code_5": "", + "paragraph2:text_6": ". ", + "authors": [ + { + "name": "Joe" + }, + { + "name": "Alice" + } + ], + "updated": "Jan 1st, 2016", + "parameters": [ + "parameter 1", + "parameter 2" + ] +} \ No newline at end of file diff --git a/test/tmp/edge-case/empty-element.html b/test/tmp/edge-case/empty-element.html new file mode 100644 index 00000000..6a1b9b88 --- /dev/null +++ b/test/tmp/edge-case/empty-element.html @@ -0,0 +1,21 @@ +Cgo= + \ No newline at end of file diff --git a/test/tmp/edge-case/empty-element.json b/test/tmp/edge-case/empty-element.json new file mode 100644 index 00000000..ce3f5d10 --- /dev/null +++ b/test/tmp/edge-case/empty-element.json @@ -0,0 +1,4 @@ +{ + "meta": {}, + "model": {} +} \ No newline at end of file diff --git a/test/tmp/fallback-text-element/fallback-text-element.html b/test/tmp/fallback-text-element/fallback-text-element.html new file mode 100644 index 00000000..aee6bbe0 --- /dev/null +++ b/test/tmp/fallback-text-element/fallback-text-element.html @@ -0,0 +1,160 @@ +CiAgICBvdXRlcm1vc3QgdGV4dCBhdCB0aGUgYmVnaW5uaW5nIAogICAgPGRpdj48ZGl2PjwvZGl2PjwvZGl2PjwhLS0gbmVzdGVkIGVtcHR5IGRpdiAtLT4KICAgIDxzcGFuIGlkPSJ3aGl0ZXNwYWNlIj4gJm5ic3A7IDwvc3Bhbj4KICAgIDxoMT5vdXRlcm1vc3QgaGVhZGVyIDE8L2gxPgogICAgb3V0ZXJtb3N0IHRleHQgaW4gdGhlIG1pZGRsZSAKICAgIDxzcGFuPnNpbXBsZSB0ZXh0IHdpdGhvdXQgaWQ8L3NwYW4+CiAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRob3V0IGlkIDI8L3NwYW4+CiAgICA8c3BhbiBpZD0ibGFiZWwtMSI+c2ltcGxlIHRleHQgd2l0aCBpZDwvc3Bhbj4KICAgIDxzcGFuIGlkPSJsYWJlbC0yIj5zaW1wbGUgdGV4dCB3aXRoIGlkIDI8L3NwYW4+CiAgICA8ZGl2PgogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2PC9zcGFuPiAKICAgICAgPHNwYW4+c2ltcGxlIHRleHQgd2l0aGluIGRpdiAyPC9zcGFuPiAKICAgICAgPGRpdj48ZGl2PmdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2PC9kaXY+PC9kaXY+IAogICAgPC9kaXY+CiAgICA8ZGl2PgogICAgICBzaW1wbGUgdGV4dCBhcyB0aGUgZmlyc3QgZWxlbWVudCBpbiBkaXYgCiAgICAgIDxzcGFuPnNpbXBsZSB0ZXh0IHdpdGhpbiBkaXY8L3NwYW4+CiAgICAgIHNpbXBsZSB0ZXh0IGluIHRoZSBtaWRkbGUgb2YgZGl2IAogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2IDI8L3NwYW4+CiAgICAgIDxkaXY+PGRpdj5ncmVhdCBncmFuZGNoaWxkIHRleHQgd2l0aGluIGRpdjwvZGl2PjwvZGl2PgogICAgICBzaW1wbGUgdGV4dCBhdCB0aGUgbGFzdCBlbGVtZW50IGluIGRpdgogICAgPC9kaXY+CiAgICA8ZGl2IGlkPSJ0b3BsZXZlbC1kaXYiPgogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2PC9zcGFuPgogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2IDI8L3NwYW4+CiAgICAgIDxkaXYgaWQ9InNlY29uZC1sZXZlbC1kaXYiPgogICAgICAgIDxkaXYgaWQ9InRoaXJkLWxldmVsLWRpdiI+Z3JlYXQgZ3JhbmRjaGlsZCB0ZXh0IHdpdGhpbiBkaXY8L2Rpdj4KICAgICAgICA8ZGl2PmdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2IHdpdGhvdXQgaWQ8L2Rpdj4KICAgICAgPC9kaXY+CiAgICA8L2Rpdj4KICAgIDxkaXY+CiAgICAgIDx1bD4KICAgICAgICA8bGk+bGluZSBpdGVtIHdpdGhvdXQgaWQgMTwvbGk+CiAgICAgICAgPGxpPmxpbmUgaXRlbSB3aXRob3V0IGlkIDI8L2xpPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aG91dCBpZCAzPC9saT4KICAgICAgPC91bD4KICAgICAgPHVsIGlkPSJsaW5lLWl0ZW1zIj4KICAgICAgICA8bGk+bGluZSBpdGVtIHdpdGggaWQgMTwvbGk+CiAgICAgICAgPGxpPmxpbmUgaXRlbSB3aXRoIGlkIDI8L2xpPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aCBpZCAzPC9saT4KICAgICAgPC91bD4KICAgIDwvZGl2PgogICAgPHA+QSBwYXJhZ3JhcGggd2l0aCA8Yj5wYXJhbWV0ZXJzPC9iPiBpcyBjb252ZXJ0ZWQgdG8gPGNvZGU+Jmx0O2kxOG4tZm9ybWF0Jmd0OzwvY29kZT4uPC9wPgogICAgPHAgaWQ9InBhcmFncmFwaCI+QSBwYXJhZ3JhcGggd2l0aCA8Yj5pZDwvYj4gaXMgY29udmVydGVkIHRvIDxjb2RlPiZsdDtpMThuLWZvcm1hdCZndDs8L2NvZGU+LjwvcD4KICAgIG91dGVybW9zdCB0ZXh0IGF0IHRoZSBlbmQgCg== + \ No newline at end of file diff --git a/test/tmp/fallback-text-element/fallback-text-element.json b/test/tmp/fallback-text-element/fallback-text-element.json new file mode 100644 index 00000000..f9b2ccf7 --- /dev/null +++ b/test/tmp/fallback-text-element/fallback-text-element.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "model": {}, + "text": " outermost text at the beginning ", + "h1_3": "outermost header 1", + "text_4": " outermost text in the middle ", + "span_5": "simple text without id", + "span_6": "simple text without id 2", + "label-1": "simple text with id", + "label-2": "simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "simple text within div", + "toplevel-div:span_1": "simple text within div 2", + "third-level-div": "great grandchild text within div", + "second-level-div:div_1": "great grandchild text within div without id", + "div_12:ul:li": "line item without id 1", + "div_12:ul:li_1": "line item without id 2", + "div_12:ul:li_2": "line item without id 3", + "line-items:li": "line item with id 1", + "line-items:li_1": "line item with id 2", + "line-items:li_2": "line item with id 3", + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "parameters", + "" + ], + "paragraph": [ + "A paragraph with {1} is converted to {2}.", + "id", + "" + ], + "text_15": " outermost text at the end " +} \ No newline at end of file diff --git a/test/tmp/i18n-attr-repo.html b/test/tmp/i18n-attr-repo.html new file mode 100644 index 00000000..57af96a6 --- /dev/null +++ b/test/tmp/i18n-attr-repo.html @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/test/tmp/i18n-attr-repo.js b/test/tmp/i18n-attr-repo.js new file mode 100644 index 00000000..ed6d4b43 --- /dev/null +++ b/test/tmp/i18n-attr-repo.js @@ -0,0 +1,520 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import '@polymer/polymer/polymer-legacy.js'; + +import { Polymer as Polymer$0 } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import { DomModule } from '@polymer/polymer/lib/elements/dom-module.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +//document.head.appendChild($_documentContainer.content); +// shared data +var sharedData = {}; + +// imperative synchronous registration of the template for Polymer 2.x +var template = $_documentContainer.content.querySelector('template#i18n-attr-repo'); +var domModule = document.createElement('dom-module'); +domModule.appendChild(template); +domModule.register('i18n-attr-repo'); +window.BehaviorsStore = window.BehaviorsStore || {}; +// Polymer function for iron-component-page documentation +var Polymer = function (proto) { + BehaviorsStore._I18nAttrRepo = proto; + BehaviorsStore._I18nAttrRepo._created(); + return Polymer$0(proto); +}; +/* +`` maintains a list of attributes targeted for UI localization. +It judges whether a specific attribute of an element requires localization or not. + + var attrRepository = + document.createElement('i18n-attr-repo'); + + attrRepository.registerLocalizableAttributes( + 'custom-element', + Polymer.DomModule.import('custom-element', 'template') + ); + attrRepository.isLocalizableAttribute(inputElement, 'placeholder'); + +### Interactions with `BehaviorsStore.I18nBehavior` + +The element is not meant for DOM attachment. The object is +a singleton object dedicated for `BehaviorsStore.I18nBehavior`. +`I18nBehavior` interacts with the localizable attributes repository in these 3 ways. + +### 1) Construct the repository for the standard elements from its own static template at the object creation. + +``` + // i18n-behavior.html + var attrRepository = + document.createElement('i18n-attr-repo'); +``` + +Pre-defined I18N-target attributes in the static template of `i18n-attr-repo`: + +``` + + + +``` + +This static list is also referenced by [`gulp-i18n-preprocess`](https://github.com/t2ym/gulp-i18n-preprocess) filter for +build-time automatic I18N of hard-coded string attributes. + +### 2) Register I18N-target attributes of custom elements from a template with id="custom" in its light DOM. + +I18N-target attributes for custom elements without I18nBehavior can be registered to the respository by this method. + +Example I18N-target attributes in a static template in the light DOM of `i18n-attr-repo`: + +``` + + + +``` + +This list is also referenced by [`gulp-i18n-preprocess`](https://github.com/t2ym/gulp-i18n-preprocess) filter for +build-time automatic I18N of hard-coded string attributes. + +Note: Type name feature is currently ineffective and reserved for further expansion of the attribute I18N features. + +### 3) Register localizable attributes of the newly registered elements from the `text-attr` attribute of the element's template. + +``` + // i18n-behavior.html, scanning custom-element template + var id = 'custom-element'; + attrRepository.registerLocalizableAttributes( + id, + Polymer.DomModule.import(id, 'template') + ); +``` +``` + // custom-element.html + + + + + + + + + +

+ + + + + + + \ No newline at end of file diff --git a/test/tmp/multiple-case/item-element.html b/test/tmp/multiple-case/item-element.html new file mode 100644 index 00000000..1082d261 --- /dev/null +++ b/test/tmp/multiple-case/item-element.html @@ -0,0 +1,24 @@ +CiAgICA8c3BhbiBpZD0ibGFiZWwiPkE8L3NwYW4+Cg== + \ No newline at end of file diff --git a/test/tmp/multiple-case/item-element.json b/test/tmp/multiple-case/item-element.json new file mode 100644 index 00000000..ccab72af --- /dev/null +++ b/test/tmp/multiple-case/item-element.json @@ -0,0 +1,5 @@ +{ + "meta": {}, + "model": {}, + "label": "A" +} \ No newline at end of file diff --git a/test/tmp/multiple-case/multiple-element.html b/test/tmp/multiple-case/multiple-element.html new file mode 100644 index 00000000..1fe20a9e --- /dev/null +++ b/test/tmp/multiple-case/multiple-element.html @@ -0,0 +1,36 @@ +CiAgICA8ZGl2IGlkPSJiYXNlIj4KICAgICAgPGRvbS1yZXBlYXQgaWQ9Iml0ZW1zIiBpdGVtcz0ie3tnZXRBcnJheShjb3VudCl9fSIgb24tZG9tLWNoYW5nZT0iZG9tQ2hhbmdlZCI+PHRlbXBsYXRlPgogICAgICAgIDxzcGFuPgogICAgICAgICAgPGl0ZW0tZWxlbWVudCBsYW5nPSJ7e2VmZmVjdGl2ZUxhbmd9fSIgb2JzZXJ2ZS1odG1sLWxhbmc9Int7b2JzZXJ2ZUh0bWxMYW5nfX0iPjwvaXRlbS1lbGVtZW50PgogICAgICAgIDwvc3Bhbj4KICAgICAgPC90ZW1wbGF0ZT48L2RvbS1yZXBlYXQ+CiAgICA8L2Rpdj4KICAgIDxkaXYgaWQ9InNhdmUiPjwvZGl2Pgo= + \ No newline at end of file diff --git a/test/tmp/multiple-case/multiple-element.json b/test/tmp/multiple-case/multiple-element.json new file mode 100644 index 00000000..ce3f5d10 --- /dev/null +++ b/test/tmp/multiple-case/multiple-element.json @@ -0,0 +1,4 @@ +{ + "meta": {}, + "model": {} +} \ No newline at end of file diff --git a/test/tmp/no-persist-test.html b/test/tmp/no-persist-test.html new file mode 100644 index 00000000..e4504460 --- /dev/null +++ b/test/tmp/no-persist-test.html @@ -0,0 +1,39 @@ + + + + + + + + + + + +

+ + + + + + + + + + \ No newline at end of file diff --git a/test/tmp/plural-gender-element/plural-gender-element.html b/test/tmp/plural-gender-element/plural-gender-element.html new file mode 100644 index 00000000..185aa6a1 --- /dev/null +++ b/test/tmp/plural-gender-element/plural-gender-element.html @@ -0,0 +1,82 @@ +CiAgICA8cD4KICAgICAgPGkxOG4tZm9ybWF0IGlkPSJjb21wb3VuZC1mb3JtYXQtdGV4dCIgb24tcmVuZGVyZWQ9Il9yZW5kZXJlZCI+CiAgICAgICAgPGpzb24tZGF0YT57CiAgICAgICAgICAiMCI6ICJZb3UgKHszfSkgZ2F2ZSBubyBnaWZ0cy4iLAogICAgICAgICAgIjEiOiB7CiAgICAgICAgICAgICJtYWxlIjogIllvdSAoezN9KSBnYXZlIGhpbSAoezR9KSB7NX0uIiwKICAgICAgICAgICAgImZlbWFsZSI6ICJZb3UgKHszfSkgZ2F2ZSBoZXIgKHs0fSkgezV9LiIsCiAgICAgICAgICAgICJvdGhlciI6ICJZb3UgKHszfSkgZ2F2ZSB0aGVtICh7NH0pIHs1fS4iCiAgICAgICAgICB9LAogICAgICAgICAgIm9uZSI6IHsKICAgICAgICAgICAgIm1hbGUiOiAiWW91ICh7M30pIGdhdmUgaGltICh7NH0pIGFuZCBvbmUgb3RoZXIgcGVyc29uIHs1fS4iLAogICAgICAgICAgICAiZmVtYWxlIjogIllvdSAoezN9KSBnYXZlIGhlciAoezR9KSBhbmQgb25lIG90aGVyIHBlcnNvbiB7NX0uIiwKICAgICAgICAgICAgIm90aGVyIjogIllvdSAoezN9KSBnYXZlIHRoZW0gKHs0fSkgYW5kIG9uZSBvdGhlciBwZXJzb24gezV9LiIKICAgICAgICAgIH0sCiAgICAgICAgICAib3RoZXIiOiAiWW91ICh7M30pIGdhdmUgdGhlbSAoezR9KSBhbmQgezF9IG90aGVyIHBlb3BsZSBnaWZ0cy4iCiAgICAgICAgfTwvanNvbi1kYXRhPgogICAgICAgIDxpMThuLW51bWJlciBvZmZzZXQ9IjEiPnt7cmVjaXBpZW50cy5sZW5ndGh9fTwvaTE4bi1udW1iZXI+CiAgICAgICAgPHNwYW4+e3tyZWNpcGllbnRzLjAuZ2VuZGVyfX08L3NwYW4+CiAgICAgICAgPHNwYW4+e3tzZW5kZXIubmFtZX19PC9zcGFuPgogICAgICAgIDxzcGFuPnt7cmVjaXBpZW50cy4wLm5hbWV9fTwvc3Bhbj4KICAgICAgICA8c3Bhbj5hIGdpZnQ8L3NwYW4+CiAgICAgIDwvaTE4bi1mb3JtYXQ+CiAgICA8L3A+Cg== + \ No newline at end of file diff --git a/test/tmp/plural-gender-element/plural-gender-element.json b/test/tmp/plural-gender-element/plural-gender-element.json new file mode 100644 index 00000000..c8cf341f --- /dev/null +++ b/test/tmp/plural-gender-element/plural-gender-element.json @@ -0,0 +1,25 @@ +{ + "meta": {}, + "model": {}, + "compound-format-text": [ + { + "0": "You ({3}) gave no gifts.", + "1": { + "male": "You ({3}) gave him ({4}) {5}.", + "female": "You ({3}) gave her ({4}) {5}.", + "other": "You ({3}) gave them ({4}) {5}." + }, + "one": { + "male": "You ({3}) gave him ({4}) and one other person {5}.", + "female": "You ({3}) gave her ({4}) and one other person {5}.", + "other": "You ({3}) gave them ({4}) and one other person {5}." + }, + "other": "You ({3}) gave them ({4}) and {1} other people gifts." + }, + "{{recipients.length - 1}}", + "{{recipients.0.gender}}", + "{{sender.name}}", + "{{recipients.0.name}}", + "a gift" + ] +} \ No newline at end of file diff --git a/test/tmp/preference-test.html b/test/tmp/preference-test.html new file mode 100644 index 00000000..ee3f08e7 --- /dev/null +++ b/test/tmp/preference-test.html @@ -0,0 +1,33 @@ + + + + + + + + + + + +

+ + + + + + + + + \ No newline at end of file diff --git a/test/tmp/preference/preference-element.html b/test/tmp/preference/preference-element.html new file mode 100644 index 00000000..5d9742d3 --- /dev/null +++ b/test/tmp/preference/preference-element.html @@ -0,0 +1,22 @@ +CiAgICA8c3BhbiBpZD0ib2xkTGFuZyI+PC9zcGFuPgo= + \ No newline at end of file diff --git a/test/tmp/preference/preference-element.json b/test/tmp/preference/preference-element.json new file mode 100644 index 00000000..ce3f5d10 --- /dev/null +++ b/test/tmp/preference/preference-element.json @@ -0,0 +1,4 @@ +{ + "meta": {}, + "model": {} +} \ No newline at end of file diff --git a/test/tmp/simple-attribute-dom-bind.json b/test/tmp/simple-attribute-dom-bind.json new file mode 100644 index 00000000..6844e568 --- /dev/null +++ b/test/tmp/simple-attribute-dom-bind.json @@ -0,0 +1,144 @@ +{ + "meta": {}, + "model": { + "standard-input": { + "placeholder": "standard HTML5 attribute" + }, + "outer-div:input_2": { + "placeholder": "standard HTML5 attribute without id" + }, + "paper-input-element": { + "label": "paper-input label", + "error-message": "paper-input error message", + "placeholder": "paper-input placeholder" + }, + "outer-div:paper-input_4": { + "label": "paper-input label without id", + "error-message": "paper-input error message without id", + "placeholder": "paper-input placeholder without id" + }, + "pie-chart": { + "options": { + "title": "Distribution of days in 2001H1" + }, + "cols": [ + { + "label": "Month", + "type": "string" + }, + { + "label": "Days", + "type": "number" + } + ], + "rows": [ + [ + "Jan", + 31 + ], + [ + "Feb", + 28 + ], + [ + "Mar", + 31 + ], + [ + "Apr", + 30 + ], + [ + "May", + 31 + ], + [ + "Jun", + 30 + ] + ] + }, + "column-chart": { + "options": { + "title": "Inventory" + }, + "data": [ + [ + "Year", + "Things", + "Stuff" + ], + [ + "2004", + 1000, + 400 + ], + [ + "2005", + 1170, + 460 + ], + [ + "2006", + 660, + 1120 + ], + [ + "2007", + 1030, + 540 + ] + ] + }, + "custom-attr": { + "custom-text-attr1": "custom text attribute 1", + "custom-text-attr2": "custom text attribute 2", + "custom-text-attr3": "custom text attribute 3" + }, + "selective-attr": { + "custom-text-attr4": [ + "{1} custom-text-attr4 attribute with param {2} and param {3} {4}", + "{{text.ordinary-div}}", + "{{text.ordinary-div}}", + "[[text.ordinary-div]]", + "{{text.ordinary-div}}" + ], + "custom-text-attr5": [ + "[[text.ordinary-div]]", + " custom-text-attr5 attribute with param ", + "{{or('',text.ordinary-div)}}", + " and param ", + "[[text.ordinary-div]]" + ], + "i18n-target": [ + "i18n-target attribute with param {1} and param {2}", + "{{text.ordinary-div}}", + "[[text.ordinary-div]]" + ], + "i18n-target2": [ + "i18n-target2 attribute with param ", + "{{or('',text.ordinary-div)}}", + " and param ", + "[[text.ordinary-div]]" + ] + }, + "selective-attr2": { + "i18n-target": "i18n-target attribute 2" + }, + "selective-attr3": { + "i18n-target6": "i18n-target6 attribute 2" + }, + "selective-attr4": { + "i18n-target6": "i18n-target6 attribute 3" + }, + "json-data-id": { + "attr1": "this attr1 is extracted", + "i18n-target-attr": "this attribute is also extracted" + }, + "template_2:json-data_1": { + "attr1": "this attr1 without id is extracted", + "i18n-target-attr": "this attribute without id is also extracted" + } + }, + "ordinary-div": "text 1" +} \ No newline at end of file diff --git a/test/tmp/simple-attribute-element/simple-attribute-element.html b/test/tmp/simple-attribute-element/simple-attribute-element.html new file mode 100644 index 00000000..97c12426 --- /dev/null +++ b/test/tmp/simple-attribute-element/simple-attribute-element.html @@ -0,0 +1,394 @@ +CiAgICA8c3R5bGUgYXR0cj0iVGhpcyBpcyBub3QgZXh0cmFjdGVkIj4KICAgIGdvb2dsZS1jaGFydCB7CiAgICAgIHdpZHRoOiAzMDBweDsKICAgIH0KICAgIDwvc3R5bGU+CiAgICA8ZGl2IGlkPSJvdXRlci1kaXYiPgogICAgICA8ZGl2IGlkPSJvcmRpbmFyeS1kaXYiIGF0dHI9IlRoaXMgaXMgbm90IHRhcmdldGVkIGZvciBleHRyYWN0aW9uIj50ZXh0IDE8L2Rpdj4KCiAgICAgIDxpbnB1dCBpZD0ic3RhbmRhcmQtaW5wdXQiIHBsYWNlaG9sZGVyPSJzdGFuZGFyZCBIVE1MNSBhdHRyaWJ1dGUiPgogICAgICA8aW5wdXQgcGxhY2Vob2xkZXI9InN0YW5kYXJkIEhUTUw1IGF0dHJpYnV0ZSB3aXRob3V0IGlkIj4KCiAgICAgIDxwYXBlci1pbnB1dCBpZD0icGFwZXItaW5wdXQtZWxlbWVudCIgbGFiZWw9InBhcGVyLWlucHV0IGxhYmVsIiBlcnJvci1tZXNzYWdlPSJwYXBlci1pbnB1dCBlcnJvciBtZXNzYWdlIiBwbGFjZWhvbGRlcj0icGFwZXItaW5wdXQgcGxhY2Vob2xkZXIiIHZhbHVlPSJ0aGlzIGlzIG5vdCBhIHRhcmdldCI+CiAgICAgIDwvcGFwZXItaW5wdXQ+CgogICAgICA8cGFwZXItaW5wdXQgbGFiZWw9InBhcGVyLWlucHV0IGxhYmVsIHdpdGhvdXQgaWQiIGVycm9yLW1lc3NhZ2U9InBhcGVyLWlucHV0IGVycm9yIG1lc3NhZ2Ugd2l0aG91dCBpZCIgcGxhY2Vob2xkZXI9InBhcGVyLWlucHV0IHBsYWNlaG9sZGVyIHdpdGhvdXQgaWQiIHZhbHVlPSJ0aGlzIGlzIG5vdCBhIHRhcmdldCI+CiAgICAgIDwvcGFwZXItaW5wdXQ+CgogICAgICA8Z29vZ2xlLWNoYXJ0IHR5cGU9InBpZSIgaWQ9InBpZS1jaGFydCIgb3B0aW9ucz0ieyZxdW90O3RpdGxlJnF1b3Q7OiAmcXVvdDtEaXN0cmlidXRpb24gb2YgZGF5cyBpbiAyMDAxSDEmcXVvdDt9IiBjb2xzPSJbIHsmcXVvdDtsYWJlbCZxdW90OzogJnF1b3Q7TW9udGgmcXVvdDssICZxdW90O3R5cGUmcXVvdDs6ICZxdW90O3N0cmluZyZxdW90O30seyZxdW90O2xhYmVsJnF1b3Q7OiAmcXVvdDtEYXlzJnF1b3Q7LCAmcXVvdDt0eXBlJnF1b3Q7OiAmcXVvdDtudW1iZXImcXVvdDt9IF0iIHJvd3M9IlsgWyZxdW90O0phbiZxdW90OywgMzFdLFsmcXVvdDtGZWImcXVvdDssIDI4XSxbJnF1b3Q7TWFyJnF1b3Q7LCAzMV0sWyZxdW90O0FwciZxdW90OywgMzBdLFsmcXVvdDtNYXkmcXVvdDssIDMxXSxbJnF1b3Q7SnVuJnF1b3Q7LCAzMF0gXSI+CiAgICAgIDwvZ29vZ2xlLWNoYXJ0PgoKICAgICAgPGdvb2dsZS1jaGFydCBpZD0iY29sdW1uLWNoYXJ0IiB0eXBlPSJjb2x1bW4iIG9wdGlvbnM9InsmcXVvdDt0aXRsZSZxdW90OzogJnF1b3Q7SW52ZW50b3J5JnF1b3Q7fSIgZGF0YT0iWyBbJnF1b3Q7WWVhciZxdW90OywgJnF1b3Q7VGhpbmdzJnF1b3Q7LCAmcXVvdDtTdHVmZiZxdW90O10sCiAgICAgICAgICAgICAgICBbJnF1b3Q7MjAwNCZxdW90OywgMTAwMCwgNDAwXSwKICAgICAgICAgICAgICAgIFsmcXVvdDsyMDA1JnF1b3Q7LCAxMTcwLCA0NjBdLAogICAgICAgICAgICAgICAgWyZxdW90OzIwMDYmcXVvdDssIDY2MCwgMTEyMF0sCiAgICAgICAgICAgICAgICBbJnF1b3Q7MjAwNyZxdW90OywgMTAzMCwgNTQwXSBdIj4KICAgICAgPC9nb29nbGUtY2hhcnQ+CgogICAgICA8dGV4dC1hdHRyaWJ1dGUtZWxlbWVudCBpZD0iY3VzdG9tLWF0dHIiIGN1c3RvbS10ZXh0LWF0dHIxPSJjdXN0b20gdGV4dCBhdHRyaWJ1dGUgMSIgY3VzdG9tLXRleHQtYXR0cjI9ImN1c3RvbSB0ZXh0IGF0dHJpYnV0ZSAyIiBjdXN0b20tdGV4dC1hdHRyMz0iY3VzdG9tIHRleHQgYXR0cmlidXRlIDMiIG91dC1vZi1zY29wZS1hdHRyPSJvdXQgb2Ygc2NvcGUgYXR0ciI+CiAgICAgIDwvdGV4dC1hdHRyaWJ1dGUtZWxlbWVudD4KCiAgICAgIDx0ZXh0LWF0dHJpYnV0ZS1lbGVtZW50IGlkPSJzZWxlY3RpdmUtYXR0ciIgYm9vbGVhbi1hdHRyPSIiIGVtcHR5LWF0dHI9IiIgc3RyaW5nLWF0dHI9ImFiYyIgY3VzdG9tLXRleHQtYXR0cjQ9Int7dGV4dC5vcmRpbmFyeS1kaXZ9fSBjdXN0b20tdGV4dC1hdHRyNCBhdHRyaWJ1dGUgd2l0aCBwYXJhbSB7e3RleHQub3JkaW5hcnktZGl2fX0gYW5kIHBhcmFtIFtbdGV4dC5vcmRpbmFyeS1kaXZdXSB7e3RleHQub3JkaW5hcnktZGl2fX0iIGN1c3RvbS10ZXh0LWF0dHI1XCQ9IltbdGV4dC5vcmRpbmFyeS1kaXZdXSBjdXN0b20tdGV4dC1hdHRyNSBhdHRyaWJ1dGUgd2l0aCBwYXJhbSB7e29yKCcnLHRleHQub3JkaW5hcnktZGl2KX19IGFuZCBwYXJhbSBbW3RleHQub3JkaW5hcnktZGl2XV0iIGkxOG4tdGFyZ2V0PSJpMThuLXRhcmdldCBhdHRyaWJ1dGUgd2l0aCBwYXJhbSB7e3RleHQub3JkaW5hcnktZGl2fX0gYW5kIHBhcmFtIFtbdGV4dC5vcmRpbmFyeS1kaXZdXSIgaTE4bi10YXJnZXQyPSJpMThuLXRhcmdldDIgYXR0cmlidXRlIHdpdGggcGFyYW0ge3tvcignJyx0ZXh0Lm9yZGluYXJ5LWRpdil9fSBhbmQgcGFyYW0gW1t0ZXh0Lm9yZGluYXJ5LWRpdl1dIj4KICAgICAgPC90ZXh0LWF0dHJpYnV0ZS1lbGVtZW50PgogICAgICA8dGV4dC1hdHRyaWJ1dGUtZWxlbWVudCBpZD0ic2VsZWN0aXZlLWF0dHIyIiBib29sZWFuLWF0dHI9IiIgYm9vbGVhbi1hdHRyMj0iIiBzdHJpbmctYXR0cj0iYWFhIiBpMThuLXRhcmdldD0iaTE4bi10YXJnZXQgYXR0cmlidXRlIDIiPgogICAgICA8L3RleHQtYXR0cmlidXRlLWVsZW1lbnQ+CiAgICAgIDx0ZXh0LWF0dHJpYnV0ZS1lbGVtZW50IGlkPSJzZWxlY3RpdmUtYXR0cjMiIGkxOG4tdGFyZ2V0Nj0iaTE4bi10YXJnZXQ2IGF0dHJpYnV0ZSAyIj4KICAgICAgPC90ZXh0LWF0dHJpYnV0ZS1lbGVtZW50PgogICAgICA8dGV4dC1hdHRyaWJ1dGUtZWxlbWVudCBpZD0ic2VsZWN0aXZlLWF0dHI0IiBib29sZWFuLWF0dHI9IiIgaTE4bi10YXJnZXQ2PSJpMThuLXRhcmdldDYgYXR0cmlidXRlIDMiIGkxOG4tdGFyZ2V0Nz0idW5tYXRjaGluZyBpMThuLXRhcmdldDQgYXR0cmlidXRlIj4KICAgICAgPC90ZXh0LWF0dHJpYnV0ZS1lbGVtZW50PgogICAgICA8dGV4dC1hdHRyaWJ1dGUtZWxlbWVudCBpZD0ic2VsZWN0aXZlLWF0dHI1IiBzdHJpbmctYXR0cj0ieHh4IiBpMThuLXRhcmdldDc9InVubWF0Y2hpbmcgaTE4bi10YXJnZXQ3IGF0dHJpYnV0ZSI+CiAgICAgIDwvdGV4dC1hdHRyaWJ1dGUtZWxlbWVudD4KCiAgICAgIDxzcGFuIGlkPSJ0ZXN0LWpzb24tZGF0YS0xIj57e21vZGVsLmpzb24tZGF0YS1pZC5hdHRyMX19PC9zcGFuPgogICAgICA8c3BhbiBpZD0idGVzdC1qc29uLWRhdGEtMiI+e3ttb2RlbC5qc29uLWRhdGEtaWQuaTE4bi10YXJnZXQtYXR0cn19PC9zcGFuPgogICAgICA8c3BhbiBpZD0idGVzdC1qc29uLWRhdGEtMyI+e3ttb2RlbC50ZW1wbGF0ZV8yOmpzb24tZGF0YV8xLmF0dHIxfX08L3NwYW4+CiAgICAgIDxzcGFuIGlkPSJ0ZXN0LWpzb24tZGF0YS00Ij57e21vZGVsLnRlbXBsYXRlXzI6anNvbi1kYXRhXzEuaTE4bi10YXJnZXQtYXR0cn19PC9zcGFuPgoKICAgIDwvZGl2PgogICAgPHRlbXBsYXRlPgogICAgICA8anNvbi1kYXRhIGlkPSJqc29uLWRhdGEtaWQiIGF0dHIxPSJ0aGlzIGF0dHIxIGlzIGV4dHJhY3RlZCIgaTE4bi10YXJnZXQtYXR0cj0idGhpcyBhdHRyaWJ1dGUgaXMgYWxzbyBleHRyYWN0ZWQiPjwvanNvbi1kYXRhPgogICAgICA8anNvbi1kYXRhIGF0dHIxPSJ0aGlzIGF0dHIxIHdpdGhvdXQgaWQgaXMgZXh0cmFjdGVkIiBpMThuLXRhcmdldC1hdHRyPSJ0aGlzIGF0dHJpYnV0ZSB3aXRob3V0IGlkIGlzIGFsc28gZXh0cmFjdGVkIj48L2pzb24tZGF0YT4KICAgIDwvdGVtcGxhdGU+Cg== + \ No newline at end of file diff --git a/test/tmp/simple-attribute-element/simple-attribute-element.json b/test/tmp/simple-attribute-element/simple-attribute-element.json new file mode 100644 index 00000000..6844e568 --- /dev/null +++ b/test/tmp/simple-attribute-element/simple-attribute-element.json @@ -0,0 +1,144 @@ +{ + "meta": {}, + "model": { + "standard-input": { + "placeholder": "standard HTML5 attribute" + }, + "outer-div:input_2": { + "placeholder": "standard HTML5 attribute without id" + }, + "paper-input-element": { + "label": "paper-input label", + "error-message": "paper-input error message", + "placeholder": "paper-input placeholder" + }, + "outer-div:paper-input_4": { + "label": "paper-input label without id", + "error-message": "paper-input error message without id", + "placeholder": "paper-input placeholder without id" + }, + "pie-chart": { + "options": { + "title": "Distribution of days in 2001H1" + }, + "cols": [ + { + "label": "Month", + "type": "string" + }, + { + "label": "Days", + "type": "number" + } + ], + "rows": [ + [ + "Jan", + 31 + ], + [ + "Feb", + 28 + ], + [ + "Mar", + 31 + ], + [ + "Apr", + 30 + ], + [ + "May", + 31 + ], + [ + "Jun", + 30 + ] + ] + }, + "column-chart": { + "options": { + "title": "Inventory" + }, + "data": [ + [ + "Year", + "Things", + "Stuff" + ], + [ + "2004", + 1000, + 400 + ], + [ + "2005", + 1170, + 460 + ], + [ + "2006", + 660, + 1120 + ], + [ + "2007", + 1030, + 540 + ] + ] + }, + "custom-attr": { + "custom-text-attr1": "custom text attribute 1", + "custom-text-attr2": "custom text attribute 2", + "custom-text-attr3": "custom text attribute 3" + }, + "selective-attr": { + "custom-text-attr4": [ + "{1} custom-text-attr4 attribute with param {2} and param {3} {4}", + "{{text.ordinary-div}}", + "{{text.ordinary-div}}", + "[[text.ordinary-div]]", + "{{text.ordinary-div}}" + ], + "custom-text-attr5": [ + "[[text.ordinary-div]]", + " custom-text-attr5 attribute with param ", + "{{or('',text.ordinary-div)}}", + " and param ", + "[[text.ordinary-div]]" + ], + "i18n-target": [ + "i18n-target attribute with param {1} and param {2}", + "{{text.ordinary-div}}", + "[[text.ordinary-div]]" + ], + "i18n-target2": [ + "i18n-target2 attribute with param ", + "{{or('',text.ordinary-div)}}", + " and param ", + "[[text.ordinary-div]]" + ] + }, + "selective-attr2": { + "i18n-target": "i18n-target attribute 2" + }, + "selective-attr3": { + "i18n-target6": "i18n-target6 attribute 2" + }, + "selective-attr4": { + "i18n-target6": "i18n-target6 attribute 3" + }, + "json-data-id": { + "attr1": "this attr1 is extracted", + "i18n-target-attr": "this attribute is also extracted" + }, + "template_2:json-data_1": { + "attr1": "this attr1 without id is extracted", + "i18n-target-attr": "this attribute without id is also extracted" + } + }, + "ordinary-div": "text 1" +} \ No newline at end of file diff --git a/test/tmp/simple-attribute-element/text-attribute-element.html b/test/tmp/simple-attribute-element/text-attribute-element.html new file mode 100644 index 00000000..3ef3d236 --- /dev/null +++ b/test/tmp/simple-attribute-element/text-attribute-element.html @@ -0,0 +1,79 @@ +CiAgICA8c3BhbiBpZD0iYXR0cjEiPnt7Y3VzdG9tVGV4dEF0dHIxfX08L3NwYW4+CiAgICA8c3BhbiBpZD0iYXR0cjIiPnt7Y3VzdG9tVGV4dEF0dHIyfX08L3NwYW4+CiAgICA8c3BhbiBpZD0iYXR0cjMiPnt7Y3VzdG9tVGV4dEF0dHIzfX08L3NwYW4+CiAgICA8c3BhbiBpZD0iYXR0cjQiPnt7b3V0T2ZTY29wZUF0dHJ9fTwvc3Bhbj4KICAgIDxzcGFuPnRleHQ8L3NwYW4+Cg== + + + + \ No newline at end of file diff --git a/test/tmp/simple-attribute-element/text-attribute-element.json b/test/tmp/simple-attribute-element/text-attribute-element.json new file mode 100644 index 00000000..2715342d --- /dev/null +++ b/test/tmp/simple-attribute-element/text-attribute-element.json @@ -0,0 +1,5 @@ +{ + "meta": {}, + "model": {}, + "span_4": "text" +} \ No newline at end of file diff --git a/test/tmp/simple-text-dom-bind.json b/test/tmp/simple-text-dom-bind.json new file mode 100644 index 00000000..f9b2ccf7 --- /dev/null +++ b/test/tmp/simple-text-dom-bind.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "model": {}, + "text": " outermost text at the beginning ", + "h1_3": "outermost header 1", + "text_4": " outermost text in the middle ", + "span_5": "simple text without id", + "span_6": "simple text without id 2", + "label-1": "simple text with id", + "label-2": "simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "simple text within div", + "toplevel-div:span_1": "simple text within div 2", + "third-level-div": "great grandchild text within div", + "second-level-div:div_1": "great grandchild text within div without id", + "div_12:ul:li": "line item without id 1", + "div_12:ul:li_1": "line item without id 2", + "div_12:ul:li_2": "line item without id 3", + "line-items:li": "line item with id 1", + "line-items:li_1": "line item with id 2", + "line-items:li_2": "line item with id 3", + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "parameters", + "" + ], + "paragraph": [ + "A paragraph with {1} is converted to {2}.", + "id", + "" + ], + "text_15": " outermost text at the end " +} \ No newline at end of file diff --git a/test/tmp/simple-text-element/simple-text-element.html b/test/tmp/simple-text-element/simple-text-element.html new file mode 100644 index 00000000..a722109e --- /dev/null +++ b/test/tmp/simple-text-element/simple-text-element.html @@ -0,0 +1,160 @@ +CiAgICBvdXRlcm1vc3QgdGV4dCBhdCB0aGUgYmVnaW5uaW5nIAogICAgPGRpdj48ZGl2PjwvZGl2PjwvZGl2PjwhLS0gbmVzdGVkIGVtcHR5IGRpdiAtLT4KICAgIDxzcGFuIGlkPSJ3aGl0ZXNwYWNlIj4gJm5ic3A7IDwvc3Bhbj4KICAgIDxoMT5vdXRlcm1vc3QgaGVhZGVyIDE8L2gxPgogICAgb3V0ZXJtb3N0IHRleHQgaW4gdGhlIG1pZGRsZSAKICAgIDxzcGFuPnNpbXBsZSB0ZXh0IHdpdGhvdXQgaWQ8L3NwYW4+CiAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRob3V0IGlkIDI8L3NwYW4+CiAgICA8c3BhbiBpZD0ibGFiZWwtMSI+c2ltcGxlIHRleHQgd2l0aCBpZDwvc3Bhbj4KICAgIDxzcGFuIGlkPSJsYWJlbC0yIj5zaW1wbGUgdGV4dCB3aXRoIGlkIDI8L3NwYW4+CiAgICA8ZGl2PgogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2PC9zcGFuPiAKICAgICAgPHNwYW4+c2ltcGxlIHRleHQgd2l0aGluIGRpdiAyPC9zcGFuPiAKICAgICAgPGRpdj48ZGl2PmdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2PC9kaXY+PC9kaXY+IAogICAgPC9kaXY+CiAgICA8ZGl2PgogICAgICBzaW1wbGUgdGV4dCBhcyB0aGUgZmlyc3QgZWxlbWVudCBpbiBkaXYgCiAgICAgIDxzcGFuPnNpbXBsZSB0ZXh0IHdpdGhpbiBkaXY8L3NwYW4+CiAgICAgIHNpbXBsZSB0ZXh0IGluIHRoZSBtaWRkbGUgb2YgZGl2IAogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2IDI8L3NwYW4+CiAgICAgIDxkaXY+PGRpdj5ncmVhdCBncmFuZGNoaWxkIHRleHQgd2l0aGluIGRpdjwvZGl2PjwvZGl2PgogICAgICBzaW1wbGUgdGV4dCBhdCB0aGUgbGFzdCBlbGVtZW50IGluIGRpdgogICAgPC9kaXY+CiAgICA8ZGl2IGlkPSJ0b3BsZXZlbC1kaXYiPgogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2PC9zcGFuPgogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2IDI8L3NwYW4+CiAgICAgIDxkaXYgaWQ9InNlY29uZC1sZXZlbC1kaXYiPgogICAgICAgIDxkaXYgaWQ9InRoaXJkLWxldmVsLWRpdiI+Z3JlYXQgZ3JhbmRjaGlsZCB0ZXh0IHdpdGhpbiBkaXY8L2Rpdj4KICAgICAgICA8ZGl2PmdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2IHdpdGhvdXQgaWQ8L2Rpdj4KICAgICAgPC9kaXY+CiAgICA8L2Rpdj4KICAgIDxkaXY+CiAgICAgIDx1bD4KICAgICAgICA8bGk+bGluZSBpdGVtIHdpdGhvdXQgaWQgMTwvbGk+CiAgICAgICAgPGxpPmxpbmUgaXRlbSB3aXRob3V0IGlkIDI8L2xpPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aG91dCBpZCAzPC9saT4KICAgICAgPC91bD4KICAgICAgPHVsIGlkPSJsaW5lLWl0ZW1zIj4KICAgICAgICA8bGk+bGluZSBpdGVtIHdpdGggaWQgMTwvbGk+CiAgICAgICAgPGxpPmxpbmUgaXRlbSB3aXRoIGlkIDI8L2xpPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aCBpZCAzPC9saT4KICAgICAgPC91bD4KICAgIDwvZGl2PgogICAgPHA+QSBwYXJhZ3JhcGggd2l0aCA8Yj5wYXJhbWV0ZXJzPC9iPiBpcyBjb252ZXJ0ZWQgdG8gPGNvZGU+Jmx0O2kxOG4tZm9ybWF0Jmd0OzwvY29kZT4uPC9wPgogICAgPHAgaWQ9InBhcmFncmFwaCI+QSBwYXJhZ3JhcGggd2l0aCA8Yj5pZDwvYj4gaXMgY29udmVydGVkIHRvIDxjb2RlPiZsdDtpMThuLWZvcm1hdCZndDs8L2NvZGU+LjwvcD4KICAgIG91dGVybW9zdCB0ZXh0IGF0IHRoZSBlbmQgCg== + \ No newline at end of file diff --git a/test/tmp/simple-text-element/simple-text-element.json b/test/tmp/simple-text-element/simple-text-element.json new file mode 100644 index 00000000..f9b2ccf7 --- /dev/null +++ b/test/tmp/simple-text-element/simple-text-element.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "model": {}, + "text": " outermost text at the beginning ", + "h1_3": "outermost header 1", + "text_4": " outermost text in the middle ", + "span_5": "simple text without id", + "span_6": "simple text without id 2", + "label-1": "simple text with id", + "label-2": "simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "simple text within div", + "toplevel-div:span_1": "simple text within div 2", + "third-level-div": "great grandchild text within div", + "second-level-div:div_1": "great grandchild text within div without id", + "div_12:ul:li": "line item without id 1", + "div_12:ul:li_1": "line item without id 2", + "div_12:ul:li_2": "line item without id 3", + "line-items:li": "line item with id 1", + "line-items:li_1": "line item with id 2", + "line-items:li_2": "line item with id 3", + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "parameters", + "" + ], + "paragraph": [ + "A paragraph with {1} is converted to {2}.", + "id", + "" + ], + "text_15": " outermost text at the end " +} \ No newline at end of file diff --git a/test/tmp/simple-text-id-element/simple-text-id-element.html b/test/tmp/simple-text-id-element/simple-text-id-element.html new file mode 100644 index 00000000..1d8c6712 --- /dev/null +++ b/test/tmp/simple-text-id-element/simple-text-id-element.html @@ -0,0 +1,158 @@ +CiAgICBvdXRlcm1vc3QgdGV4dCBhdCB0aGUgYmVnaW5uaW5nIAogICAgPGRpdj48ZGl2PjwvZGl2PjwvZGl2PjwhLS0gbmVzdGVkIGVtcHR5IGRpdiAtLT4KICAgIDxzcGFuIHRleHQtaWQ9IndoaXRlc3BhY2UiPiAmbmJzcDsgPC9zcGFuPgogICAgPGgxPm91dGVybW9zdCBoZWFkZXIgMTwvaDE+CiAgICBvdXRlcm1vc3QgdGV4dCBpbiB0aGUgbWlkZGxlIAogICAgPHNwYW4+c2ltcGxlIHRleHQgd2l0aG91dCBpZDwvc3Bhbj4KICAgIDxzcGFuPnNpbXBsZSB0ZXh0IHdpdGhvdXQgaWQgMjwvc3Bhbj4KICAgIDxzcGFuIHRleHQtaWQ9ImxhYmVsLTEiPnNpbXBsZSB0ZXh0IHdpdGggaWQ8L3NwYW4+CiAgICA8c3BhbiB0ZXh0LWlkPSJsYWJlbC0yIj5zaW1wbGUgdGV4dCB3aXRoIGlkIDI8L3NwYW4+CiAgICA8ZGl2PgogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2PC9zcGFuPiAKICAgICAgPHNwYW4+c2ltcGxlIHRleHQgd2l0aGluIGRpdiAyPC9zcGFuPiAKICAgICAgPGRpdj48ZGl2PmdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2PC9kaXY+PC9kaXY+IAogICAgPC9kaXY+CiAgICA8ZGl2PgogICAgICBzaW1wbGUgdGV4dCBhcyB0aGUgZmlyc3QgZWxlbWVudCBpbiBkaXYgCiAgICAgIDxzcGFuPnNpbXBsZSB0ZXh0IHdpdGhpbiBkaXY8L3NwYW4+CiAgICAgIHNpbXBsZSB0ZXh0IGluIHRoZSBtaWRkbGUgb2YgZGl2IAogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2IDI8L3NwYW4+CiAgICAgIDxkaXY+PGRpdj5ncmVhdCBncmFuZGNoaWxkIHRleHQgd2l0aGluIGRpdjwvZGl2PjwvZGl2PgogICAgICBzaW1wbGUgdGV4dCBhdCB0aGUgbGFzdCBlbGVtZW50IGluIGRpdgogICAgPC9kaXY+CiAgICA8ZGl2IHRleHQtaWQ9InRvcGxldmVsLWRpdiI+CiAgICAgIDxzcGFuPnNpbXBsZSB0ZXh0IHdpdGhpbiBkaXY8L3NwYW4+CiAgICAgIDxzcGFuPnNpbXBsZSB0ZXh0IHdpdGhpbiBkaXYgMjwvc3Bhbj4KICAgICAgPGRpdiB0ZXh0LWlkPSJzZWNvbmQtbGV2ZWwtZGl2Ij4KICAgICAgICA8ZGl2IHRleHQtaWQ9InRoaXJkLWxldmVsLWRpdiI+Z3JlYXQgZ3JhbmRjaGlsZCB0ZXh0IHdpdGhpbiBkaXY8L2Rpdj4KICAgICAgICA8ZGl2PmdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2IHdpdGhvdXQgaWQ8L2Rpdj4KICAgICAgPC9kaXY+CiAgICA8L2Rpdj4KICAgIDxkaXY+CiAgICAgIDx1bD4KICAgICAgICA8bGk+bGluZSBpdGVtIHdpdGhvdXQgaWQgMTwvbGk+CiAgICAgICAgPGxpPmxpbmUgaXRlbSB3aXRob3V0IGlkIDI8L2xpPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aG91dCBpZCAzPC9saT4KICAgICAgPC91bD4KICAgICAgPHVsIHRleHQtaWQ9ImxpbmUtaXRlbXMiPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aCBpZCAxPC9saT4KICAgICAgICA8bGk+bGluZSBpdGVtIHdpdGggaWQgMjwvbGk+CiAgICAgICAgPGxpPmxpbmUgaXRlbSB3aXRoIGlkIDM8L2xpPgogICAgICA8L3VsPgogICAgPC9kaXY+CiAgICA8cD5BIHBhcmFncmFwaCB3aXRoIDxiPnBhcmFtZXRlcnM8L2I+IGlzIGNvbnZlcnRlZCB0byA8Y29kZT4mbHQ7aTE4bi1mb3JtYXQmZ3Q7PC9jb2RlPi48L3A+CiAgICA8cCB0ZXh0LWlkPSJwYXJhZ3JhcGgiPkEgcGFyYWdyYXBoIHdpdGggPGI+aWQ8L2I+IGlzIGNvbnZlcnRlZCB0byA8Y29kZT4mbHQ7aTE4bi1mb3JtYXQmZ3Q7PC9jb2RlPi48L3A+CiAgICBvdXRlcm1vc3QgdGV4dCBhdCB0aGUgZW5kIAo= + \ No newline at end of file diff --git a/test/tmp/simple-text-id-element/simple-text-id-element.json b/test/tmp/simple-text-id-element/simple-text-id-element.json new file mode 100644 index 00000000..0e01076e --- /dev/null +++ b/test/tmp/simple-text-id-element/simple-text-id-element.json @@ -0,0 +1,47 @@ +{ + "meta": {}, + "model": {}, + "text": " outermost text at the beginning ", + "h1_3": "outermost header 1", + "text_4": " outermost text in the middle ", + "span_5": "simple text without id", + "span_6": "simple text without id 2", + "label-1": "simple text with id", + "label-2": "simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "simple text within div", + "toplevel-div:span_1": "simple text within div 2", + "second-level-div": [ + " {1}\n {2} ", + "great grandchild text within div", + "great grandchild text within div without id" + ], + "div_12:ul:li": "line item without id 1", + "div_12:ul:li_1": "line item without id 2", + "div_12:ul:li_2": "line item without id 3", + "line-items": [ + " {1}\n {2}\n {3} ", + "line item with id 1", + "line item with id 2", + "line item with id 3" + ], + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "parameters", + "" + ], + "paragraph": [ + "A paragraph with {1} is converted to {2}.", + "id", + "" + ], + "text_15": " outermost text at the end " +} \ No newline at end of file diff --git a/test/tmp/template-default-lang-test.html b/test/tmp/template-default-lang-test.html new file mode 100644 index 00000000..0d7710d7 --- /dev/null +++ b/test/tmp/template-default-lang-test.html @@ -0,0 +1,37 @@ + + + + + + + + + + + +

+ + + + + + + + + + + \ No newline at end of file diff --git a/test/tmp/template-default-lang/null-template-default-lang-element.html b/test/tmp/template-default-lang/null-template-default-lang-element.html new file mode 100644 index 00000000..a42ec87a --- /dev/null +++ b/test/tmp/template-default-lang/null-template-default-lang-element.html @@ -0,0 +1,160 @@ +CiAgICBvdXRlcm1vc3QgdGV4dCBhdCB0aGUgYmVnaW5uaW5nIAogICAgPGRpdj48ZGl2PjwvZGl2PjwvZGl2PjwhLS0gbmVzdGVkIGVtcHR5IGRpdiAtLT4KICAgIDxzcGFuIGlkPSJ3aGl0ZXNwYWNlIj4gJm5ic3A7IDwvc3Bhbj4KICAgIDxoMT5vdXRlcm1vc3QgaGVhZGVyIDE8L2gxPgogICAgb3V0ZXJtb3N0IHRleHQgaW4gdGhlIG1pZGRsZSAKICAgIDxzcGFuPnNpbXBsZSB0ZXh0IHdpdGhvdXQgaWQ8L3NwYW4+CiAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRob3V0IGlkIDI8L3NwYW4+CiAgICA8c3BhbiBpZD0ibGFiZWwtMSI+c2ltcGxlIHRleHQgd2l0aCBpZDwvc3Bhbj4KICAgIDxzcGFuIGlkPSJsYWJlbC0yIj5zaW1wbGUgdGV4dCB3aXRoIGlkIDI8L3NwYW4+CiAgICA8ZGl2PgogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2PC9zcGFuPiAKICAgICAgPHNwYW4+c2ltcGxlIHRleHQgd2l0aGluIGRpdiAyPC9zcGFuPiAKICAgICAgPGRpdj48ZGl2PmdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2PC9kaXY+PC9kaXY+IAogICAgPC9kaXY+CiAgICA8ZGl2PgogICAgICBzaW1wbGUgdGV4dCBhcyB0aGUgZmlyc3QgZWxlbWVudCBpbiBkaXYgCiAgICAgIDxzcGFuPnNpbXBsZSB0ZXh0IHdpdGhpbiBkaXY8L3NwYW4+CiAgICAgIHNpbXBsZSB0ZXh0IGluIHRoZSBtaWRkbGUgb2YgZGl2IAogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2IDI8L3NwYW4+CiAgICAgIDxkaXY+PGRpdj5ncmVhdCBncmFuZGNoaWxkIHRleHQgd2l0aGluIGRpdjwvZGl2PjwvZGl2PgogICAgICBzaW1wbGUgdGV4dCBhdCB0aGUgbGFzdCBlbGVtZW50IGluIGRpdgogICAgPC9kaXY+CiAgICA8ZGl2IGlkPSJ0b3BsZXZlbC1kaXYiPgogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2PC9zcGFuPgogICAgICA8c3Bhbj5zaW1wbGUgdGV4dCB3aXRoaW4gZGl2IDI8L3NwYW4+CiAgICAgIDxkaXYgaWQ9InNlY29uZC1sZXZlbC1kaXYiPgogICAgICAgIDxkaXYgaWQ9InRoaXJkLWxldmVsLWRpdiI+Z3JlYXQgZ3JhbmRjaGlsZCB0ZXh0IHdpdGhpbiBkaXY8L2Rpdj4KICAgICAgICA8ZGl2PmdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2IHdpdGhvdXQgaWQ8L2Rpdj4KICAgICAgPC9kaXY+CiAgICA8L2Rpdj4KICAgIDxkaXY+CiAgICAgIDx1bD4KICAgICAgICA8bGk+bGluZSBpdGVtIHdpdGhvdXQgaWQgMTwvbGk+CiAgICAgICAgPGxpPmxpbmUgaXRlbSB3aXRob3V0IGlkIDI8L2xpPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aG91dCBpZCAzPC9saT4KICAgICAgPC91bD4KICAgICAgPHVsIGlkPSJsaW5lLWl0ZW1zIj4KICAgICAgICA8bGk+bGluZSBpdGVtIHdpdGggaWQgMTwvbGk+CiAgICAgICAgPGxpPmxpbmUgaXRlbSB3aXRoIGlkIDI8L2xpPgogICAgICAgIDxsaT5saW5lIGl0ZW0gd2l0aCBpZCAzPC9saT4KICAgICAgPC91bD4KICAgIDwvZGl2PgogICAgPHA+QSBwYXJhZ3JhcGggd2l0aCA8Yj5wYXJhbWV0ZXJzPC9iPiBpcyBjb252ZXJ0ZWQgdG8gPGNvZGU+Jmx0O2kxOG4tZm9ybWF0Jmd0OzwvY29kZT4uPC9wPgogICAgPHAgaWQ9InBhcmFncmFwaCI+QSBwYXJhZ3JhcGggd2l0aCA8Yj5pZDwvYj4gaXMgY29udmVydGVkIHRvIDxjb2RlPiZsdDtpMThuLWZvcm1hdCZndDs8L2NvZGU+LjwvcD4KICAgIG91dGVybW9zdCB0ZXh0IGF0IHRoZSBlbmQgCg== + \ No newline at end of file diff --git a/test/tmp/template-default-lang/null-template-default-lang-element.json b/test/tmp/template-default-lang/null-template-default-lang-element.json new file mode 100644 index 00000000..f9b2ccf7 --- /dev/null +++ b/test/tmp/template-default-lang/null-template-default-lang-element.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "model": {}, + "text": " outermost text at the beginning ", + "h1_3": "outermost header 1", + "text_4": " outermost text in the middle ", + "span_5": "simple text without id", + "span_6": "simple text without id 2", + "label-1": "simple text with id", + "label-2": "simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "simple text within div", + "toplevel-div:span_1": "simple text within div 2", + "third-level-div": "great grandchild text within div", + "second-level-div:div_1": "great grandchild text within div without id", + "div_12:ul:li": "line item without id 1", + "div_12:ul:li_1": "line item without id 2", + "div_12:ul:li_2": "line item without id 3", + "line-items:li": "line item with id 1", + "line-items:li_1": "line item with id 2", + "line-items:li_2": "line item with id 3", + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "parameters", + "" + ], + "paragraph": [ + "A paragraph with {1} is converted to {2}.", + "id", + "" + ], + "text_15": " outermost text at the end " +} \ No newline at end of file diff --git a/test/tmp/template-default-lang/template-default-lang-element.html b/test/tmp/template-default-lang/template-default-lang-element.html new file mode 100644 index 00000000..f6bb4ac7 --- /dev/null +++ b/test/tmp/template-default-lang/template-default-lang-element.html @@ -0,0 +1,160 @@ +CiAgICBmciBvdXRlcm1vc3QgdGV4dCBhdCB0aGUgYmVnaW5uaW5nIAogICAgPGRpdj48ZGl2PjwvZGl2PjwvZGl2PjwhLS0gbmVzdGVkIGVtcHR5IGRpdiAtLT4KICAgIDxzcGFuIGlkPSJ3aGl0ZXNwYWNlIj4gJm5ic3A7IDwvc3Bhbj4KICAgIDxoMT5mciBvdXRlcm1vc3QgaGVhZGVyIDE8L2gxPgogICAgZnIgb3V0ZXJtb3N0IHRleHQgaW4gdGhlIG1pZGRsZSAKICAgIDxzcGFuPmZyIHNpbXBsZSB0ZXh0IHdpdGhvdXQgaWQ8L3NwYW4+CiAgICA8c3Bhbj5mciBzaW1wbGUgdGV4dCB3aXRob3V0IGlkIDI8L3NwYW4+CiAgICA8c3BhbiBpZD0ibGFiZWwtMSI+ZnIgc2ltcGxlIHRleHQgd2l0aCBpZDwvc3Bhbj4KICAgIDxzcGFuIGlkPSJsYWJlbC0yIj5mciBzaW1wbGUgdGV4dCB3aXRoIGlkIDI8L3NwYW4+CiAgICA8ZGl2PgogICAgICA8c3Bhbj5mciBzaW1wbGUgdGV4dCB3aXRoaW4gZGl2PC9zcGFuPiAKICAgICAgPHNwYW4+ZnIgc2ltcGxlIHRleHQgd2l0aGluIGRpdiAyPC9zcGFuPiAKICAgICAgPGRpdj48ZGl2PmZyIGdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2PC9kaXY+PC9kaXY+IAogICAgPC9kaXY+CiAgICA8ZGl2PgogICAgICBmciBzaW1wbGUgdGV4dCBhcyB0aGUgZmlyc3QgZWxlbWVudCBpbiBkaXYgCiAgICAgIDxzcGFuPmZyIHNpbXBsZSB0ZXh0IHdpdGhpbiBkaXY8L3NwYW4+CiAgICAgIGZyIHNpbXBsZSB0ZXh0IGluIHRoZSBtaWRkbGUgb2YgZGl2IAogICAgICA8c3Bhbj5mciBzaW1wbGUgdGV4dCB3aXRoaW4gZGl2IDI8L3NwYW4+CiAgICAgIDxkaXY+PGRpdj5mciBncmVhdCBncmFuZGNoaWxkIHRleHQgd2l0aGluIGRpdjwvZGl2PjwvZGl2PgogICAgICBmciBzaW1wbGUgdGV4dCBhdCB0aGUgbGFzdCBlbGVtZW50IGluIGRpdgogICAgPC9kaXY+CiAgICA8ZGl2IGlkPSJ0b3BsZXZlbC1kaXYiPgogICAgICA8c3Bhbj5mciBzaW1wbGUgdGV4dCB3aXRoaW4gZGl2PC9zcGFuPgogICAgICA8c3Bhbj5mciBzaW1wbGUgdGV4dCB3aXRoaW4gZGl2IDI8L3NwYW4+CiAgICAgIDxkaXYgaWQ9InNlY29uZC1sZXZlbC1kaXYiPgogICAgICAgIDxkaXYgaWQ9InRoaXJkLWxldmVsLWRpdiI+ZnIgZ3JlYXQgZ3JhbmRjaGlsZCB0ZXh0IHdpdGhpbiBkaXY8L2Rpdj4KICAgICAgICA8ZGl2PmZyIGdyZWF0IGdyYW5kY2hpbGQgdGV4dCB3aXRoaW4gZGl2IHdpdGhvdXQgaWQ8L2Rpdj4KICAgICAgPC9kaXY+CiAgICA8L2Rpdj4KICAgIDxkaXY+CiAgICAgIDx1bD4KICAgICAgICA8bGk+ZnIgbGluZSBpdGVtIHdpdGhvdXQgaWQgMTwvbGk+CiAgICAgICAgPGxpPmZyIGxpbmUgaXRlbSB3aXRob3V0IGlkIDI8L2xpPgogICAgICAgIDxsaT5mciBsaW5lIGl0ZW0gd2l0aG91dCBpZCAzPC9saT4KICAgICAgPC91bD4KICAgICAgPHVsIGlkPSJsaW5lLWl0ZW1zIj4KICAgICAgICA8bGk+ZnIgbGluZSBpdGVtIHdpdGggaWQgMTwvbGk+CiAgICAgICAgPGxpPmZyIGxpbmUgaXRlbSB3aXRoIGlkIDI8L2xpPgogICAgICAgIDxsaT5mciBsaW5lIGl0ZW0gd2l0aCBpZCAzPC9saT4KICAgICAgPC91bD4KICAgIDwvZGl2PgogICAgPHA+ZnIgQSBwYXJhZ3JhcGggd2l0aCA8Yj5mciBwYXJhbWV0ZXJzPC9iPiBpcyBjb252ZXJ0ZWQgdG8gPGNvZGU+ZnIgJmx0O2kxOG4tZm9ybWF0Jmd0OzwvY29kZT4uPC9wPgogICAgPHAgaWQ9InBhcmFncmFwaCI+ZnIgQSBwYXJhZ3JhcGggd2l0aCA8Yj5mciBpZDwvYj4gaXMgY29udmVydGVkIHRvIDxjb2RlPmZyICZsdDtpMThuLWZvcm1hdCZndDs8L2NvZGU+LjwvcD4KICAgIGZyIG91dGVybW9zdCB0ZXh0IGF0IHRoZSBlbmQgCg== + \ No newline at end of file diff --git a/test/tmp/template-default-lang/template-default-lang-element.json b/test/tmp/template-default-lang/template-default-lang-element.json new file mode 100644 index 00000000..21a74b9c --- /dev/null +++ b/test/tmp/template-default-lang/template-default-lang-element.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "model": {}, + "text": " fr outermost text at the beginning ", + "h1_3": "fr outermost header 1", + "text_4": " fr outermost text in the middle ", + "span_5": "fr simple text without id", + "span_6": "fr simple text without id 2", + "label-1": "fr simple text with id", + "label-2": "fr simple text with id 2", + "div_9:span": "fr simple text within div", + "div_9:span_1": "fr simple text within div 2", + "div_9:div_2:div": "fr great grandchild text within div", + "div_10:text": " fr simple text as the first element in div ", + "div_10:span_1": "fr simple text within div", + "div_10:text_2": " fr simple text in the middle of div ", + "div_10:span_3": "fr simple text within div 2", + "div_10:div_4:div": "fr great grandchild text within div", + "div_10:text_5": " fr simple text at the last element in div ", + "toplevel-div:span": "fr simple text within div", + "toplevel-div:span_1": "fr simple text within div 2", + "third-level-div": "fr great grandchild text within div", + "second-level-div:div_1": "fr great grandchild text within div without id", + "div_12:ul:li": "fr line item without id 1", + "div_12:ul:li_1": "fr line item without id 2", + "div_12:ul:li_2": "fr line item without id 3", + "line-items:li": "fr line item with id 1", + "line-items:li_1": "fr line item with id 2", + "line-items:li_2": "fr line item with id 3", + "p_13": [ + "fr A paragraph with {1} is converted to {2}.", + "fr parameters", + "fr " + ], + "paragraph": [ + "fr A paragraph with {1} is converted to {2}.", + "fr id", + "fr " + ], + "text_15": " fr outermost text at the end " +} \ No newline at end of file From 54c1d43a902c5683365de4f43c83233afb6acdb0 Mon Sep 17 00:00:00 2001 From: Tetsuya Mori Date: Mon, 7 Jan 2019 17:20:12 +0900 Subject: [PATCH 02/26] [WIP][test] Issue #60 Replace i18n-dom-bind templates for preprocessed ones manually --- test/preprocess3/basic-test.html | 547 +++++++++++++++++++++++-------- 1 file changed, 411 insertions(+), 136 deletions(-) diff --git a/test/preprocess3/basic-test.html b/test/preprocess3/basic-test.html index 22c8c587..bfaa59d2 100644 --- a/test/preprocess3/basic-test.html +++ b/test/preprocess3/basic-test.html @@ -88,139 +88,127 @@

+ +

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +
-
- -
`; + +`; addEventListener('suites-loaded', function () { document.body.appendChild(documentContainer.content); }); From 808249001fb5edce5a018a8ae5986eed91465a08 Mon Sep 17 00:00:00 2001 From: Tetsuya Mori Date: Mon, 7 Jan 2019 17:37:44 +0900 Subject: [PATCH 03/26] 3.0.0-pre.8 with [WIP][test] Issue #60 Add test/bundled --- package.json | 2 +- test/base-polymer.json | 35 + test/bundled/basic-test-dom-bind-dummy.html | 570 + test/bundled/basic-test-imports.js | 11433 ++++++++++++++++ test/bundled/basic-test-suites.js | 1299 ++ test/bundled/basic-test.html | 578 + .../commented-simple-text-element.js | 435 + .../commented-simple-text-element.json | 41 + .../commented-simple-text-element.fr.json | 43 + test/bundled/compound-binding-dom-bind.json | 151 + .../compound-binding-element.js | 791 ++ .../compound-binding-element.json | 151 + .../locales/compound-binding-element.fr.json | 153 + test/bundled/edge-case-dom-bind.json | 29 + test/bundled/edge-case-test-imports.js | 9684 +++++++++++++ test/bundled/edge-case-test-suites.js | 411 + test/bundled/edge-case-test.html | 121 + .../edge-case/advanced-binding-element.js | 541 + .../edge-case/advanced-binding-element.json | 36 + .../complex-compound-binding-element.js | 582 + .../complex-compound-binding-element.json | 69 + test/bundled/edge-case/empty-element.js | 106 + test/bundled/edge-case/empty-element.json | 4 + .../locales/advanced-binding-element.fr.json | 38 + .../complex-compound-binding-element.fr.json | 71 + .../edge-case/locales/empty-element.fr.json | 6 + test/bundled/edge-case/no-template-element.js | 58 + test/bundled/fake-server.js | 45 + .../fallback-text-element.js | 413 + .../fallback-text-element.json | 41 + .../locales/fallback-text-element.fr-CA.json | 114 + .../locales/fallback-text-element.fr.json | 89 + .../locales/compound-binding-dom-bind.fr.json | 153 + .../locales/simple-attribute-dom-bind.fr.json | 146 + .../locales/simple-text-dom-bind.fr.json | 43 + test/bundled/multiple-case-test-imports.js | 8891 ++++++++++++ test/bundled/multiple-case-test-suites.js | 47 + test/bundled/multiple-case-test.html | 31 + test/bundled/multiple-case/item-element.js | 110 + test/bundled/multiple-case/item-element.json | 5 + .../locales/item-element.fr.json | 7 + .../locales/multiple-element.fr.json | 6 + .../bundled/multiple-case/multiple-element.js | 365 + .../multiple-case/multiple-element.json | 4 + test/bundled/no-persist-test-imports.js | 8800 ++++++++++++ test/bundled/no-persist-test-suites.js | 64 + test/bundled/no-persist-test.html | 39 + .../locales/plural-gender-element.fr.json | 27 + .../plural-gender-element.js | 364 + .../plural-gender-element.json | 25 + test/bundled/preference-test-imports.js | 8800 ++++++++++++ test/bundled/preference-test-suites.js | 46 + test/bundled/preference-test.html | 33 + test/bundled/preference/preference-element.js | 173 + .../preference/preference-element.json | 4 + test/bundled/simple-attribute-dom-bind.json | 144 + .../locales/simple-attribute-element.fr.json | 146 + .../locales/text-attribute-element.fr.json | 7 + .../simple-attribute-element.js | 957 ++ .../simple-attribute-element.json | 144 + .../text-attribute-element.js | 321 + .../text-attribute-element.json | 5 + test/bundled/simple-text-dom-bind.json | 41 + .../locales/simple-text-element.fr.json | 43 + .../locales/simple-text-element.ru.json | 43 + .../simple-text-element.js | 413 + .../simple-text-element.json | 41 + .../locales/simple-text-id-element.fr.json | 49 + .../simple-text-id-element.js | 410 + .../simple-text-id-element.json | 47 + .../template-default-lang-test-imports.js | 9336 +++++++++++++ .../template-default-lang-test-suites.js | 325 + test/bundled/template-default-lang-test.html | 37 + ...plate-default-lang-element.zh-Hans-CN.json | 43 + ...plate-default-lang-element.zh-Hans-CN.json | 43 + .../null-template-default-lang-element.js | 409 + .../null-template-default-lang-element.json | 41 + .../template-default-lang-element.js | 409 + .../template-default-lang-element.json | 41 + test/bundled/test-runner.js | 721 + test/index.html | 4 +- 81 files changed, 70540 insertions(+), 3 deletions(-) create mode 100644 test/base-polymer.json create mode 100644 test/bundled/basic-test-dom-bind-dummy.html create mode 100644 test/bundled/basic-test-imports.js create mode 100644 test/bundled/basic-test-suites.js create mode 100644 test/bundled/basic-test.html create mode 100644 test/bundled/commented-simple-text-element/commented-simple-text-element.js create mode 100644 test/bundled/commented-simple-text-element/commented-simple-text-element.json create mode 100755 test/bundled/commented-simple-text-element/locales/commented-simple-text-element.fr.json create mode 100644 test/bundled/compound-binding-dom-bind.json create mode 100644 test/bundled/compound-binding-element/compound-binding-element.js create mode 100644 test/bundled/compound-binding-element/compound-binding-element.json create mode 100755 test/bundled/compound-binding-element/locales/compound-binding-element.fr.json create mode 100644 test/bundled/edge-case-dom-bind.json create mode 100644 test/bundled/edge-case-test-imports.js create mode 100644 test/bundled/edge-case-test-suites.js create mode 100644 test/bundled/edge-case-test.html create mode 100644 test/bundled/edge-case/advanced-binding-element.js create mode 100644 test/bundled/edge-case/advanced-binding-element.json create mode 100644 test/bundled/edge-case/complex-compound-binding-element.js create mode 100644 test/bundled/edge-case/complex-compound-binding-element.json create mode 100644 test/bundled/edge-case/empty-element.js create mode 100644 test/bundled/edge-case/empty-element.json create mode 100755 test/bundled/edge-case/locales/advanced-binding-element.fr.json create mode 100755 test/bundled/edge-case/locales/complex-compound-binding-element.fr.json create mode 100755 test/bundled/edge-case/locales/empty-element.fr.json create mode 100644 test/bundled/edge-case/no-template-element.js create mode 100644 test/bundled/fake-server.js create mode 100644 test/bundled/fallback-text-element/fallback-text-element.js create mode 100644 test/bundled/fallback-text-element/fallback-text-element.json create mode 100755 test/bundled/fallback-text-element/locales/fallback-text-element.fr-CA.json create mode 100755 test/bundled/fallback-text-element/locales/fallback-text-element.fr.json create mode 100755 test/bundled/locales/compound-binding-dom-bind.fr.json create mode 100755 test/bundled/locales/simple-attribute-dom-bind.fr.json create mode 100755 test/bundled/locales/simple-text-dom-bind.fr.json create mode 100644 test/bundled/multiple-case-test-imports.js create mode 100644 test/bundled/multiple-case-test-suites.js create mode 100644 test/bundled/multiple-case-test.html create mode 100644 test/bundled/multiple-case/item-element.js create mode 100644 test/bundled/multiple-case/item-element.json create mode 100755 test/bundled/multiple-case/locales/item-element.fr.json create mode 100644 test/bundled/multiple-case/locales/multiple-element.fr.json create mode 100644 test/bundled/multiple-case/multiple-element.js create mode 100644 test/bundled/multiple-case/multiple-element.json create mode 100644 test/bundled/no-persist-test-imports.js create mode 100644 test/bundled/no-persist-test-suites.js create mode 100644 test/bundled/no-persist-test.html create mode 100755 test/bundled/plural-gender-element/locales/plural-gender-element.fr.json create mode 100644 test/bundled/plural-gender-element/plural-gender-element.js create mode 100644 test/bundled/plural-gender-element/plural-gender-element.json create mode 100644 test/bundled/preference-test-imports.js create mode 100644 test/bundled/preference-test-suites.js create mode 100644 test/bundled/preference-test.html create mode 100644 test/bundled/preference/preference-element.js create mode 100644 test/bundled/preference/preference-element.json create mode 100644 test/bundled/simple-attribute-dom-bind.json create mode 100755 test/bundled/simple-attribute-element/locales/simple-attribute-element.fr.json create mode 100644 test/bundled/simple-attribute-element/locales/text-attribute-element.fr.json create mode 100644 test/bundled/simple-attribute-element/simple-attribute-element.js create mode 100644 test/bundled/simple-attribute-element/simple-attribute-element.json create mode 100644 test/bundled/simple-attribute-element/text-attribute-element.js create mode 100644 test/bundled/simple-attribute-element/text-attribute-element.json create mode 100644 test/bundled/simple-text-dom-bind.json create mode 100755 test/bundled/simple-text-element/locales/simple-text-element.fr.json create mode 100644 test/bundled/simple-text-element/locales/simple-text-element.ru.json create mode 100644 test/bundled/simple-text-element/simple-text-element.js create mode 100644 test/bundled/simple-text-element/simple-text-element.json create mode 100755 test/bundled/simple-text-id-element/locales/simple-text-id-element.fr.json create mode 100644 test/bundled/simple-text-id-element/simple-text-id-element.js create mode 100644 test/bundled/simple-text-id-element/simple-text-id-element.json create mode 100644 test/bundled/template-default-lang-test-imports.js create mode 100644 test/bundled/template-default-lang-test-suites.js create mode 100644 test/bundled/template-default-lang-test.html create mode 100755 test/bundled/template-default-lang/locales/null-template-default-lang-element.zh-Hans-CN.json create mode 100755 test/bundled/template-default-lang/locales/template-default-lang-element.zh-Hans-CN.json create mode 100644 test/bundled/template-default-lang/null-template-default-lang-element.js create mode 100644 test/bundled/template-default-lang/null-template-default-lang-element.json create mode 100644 test/bundled/template-default-lang/template-default-lang-element.js create mode 100644 test/bundled/template-default-lang/template-default-lang-element.json create mode 100755 test/bundled/test-runner.js diff --git a/package.json b/package.json index 58422b83..4513c6ad 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "homepage": "https://github.com/t2ym/i18n-element#readme", "name": "i18n-element", - "version": "3.0.0-pre.7", + "version": "3.0.0-pre.8", "main": "i18n-element.js", "directories": { "test": "test" diff --git a/test/base-polymer.json b/test/base-polymer.json new file mode 100644 index 00000000..fa397d04 --- /dev/null +++ b/test/base-polymer.json @@ -0,0 +1,35 @@ +{ + "entrypoint": "test/bundled/test-name-test.html", + "shell": "test/bundled/test-name-test-imports.js", + "fragments": [ + ], + "sources": [ + "test/bundled/test-name-test.html", + "test/bundled/test-name-test-imports.js" + ], + "extraDependencies": [ + ], + "builds": [ + { + "name": "esm-bundled", + "browserCapabilities": [ + "es2015", + "modules" + ], + "js": { + "minify": false + }, + "css": { + "minify": false + }, + "html": { + "minify": false + }, + "bundle": true, + "addServiceWorker": false + } + ], + "npm": true, + "componentDir": "node_modules/", + "moduleResolution": "node" +} \ No newline at end of file diff --git a/test/bundled/basic-test-dom-bind-dummy.html b/test/bundled/basic-test-dom-bind-dummy.html new file mode 100644 index 00000000..24d5f18d --- /dev/null +++ b/test/bundled/basic-test-dom-bind-dummy.html @@ -0,0 +1,570 @@ + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ + + + \ No newline at end of file diff --git a/test/bundled/basic-test-imports.js b/test/bundled/basic-test-imports.js new file mode 100644 index 00000000..08ff5f4d --- /dev/null +++ b/test/bundled/basic-test-imports.js @@ -0,0 +1,11433 @@ +/** +@license +Copyright (c) 2017 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ /* eslint-disable no-unused-vars */ /** + * When using Closure Compiler, JSCompiler_renameProperty(property, object) is replaced by the munged name for object[property] + * We cannot alias this function, so we have to use a small shim that has the same behavior when not compiling. + * + * @param {string} prop Property name + * @param {?Object} obj Reference object + * @return {string} Potentially renamed property name + */window.JSCompiler_renameProperty=function(prop,obj){return prop;};/* eslint-enable */let CSS_URL_RX=/(url\()([^)]*)(\))/g;let ABS_URL=/(^\/)|(^#)|(^[\w-\d]*:)/;let workingURL;let resolveDoc;/** + * Resolves the given URL against the provided `baseUri'. + * + * Note that this function performs no resolution for URLs that start + * with `/` (absolute URLs) or `#` (hash identifiers). For general purpose + * URL resolution, use `window.URL`. + * + * @param {string} url Input URL to resolve + * @param {?string=} baseURI Base URI to resolve the URL against + * @return {string} resolved URL + */function resolveUrl(url,baseURI){if(url&&ABS_URL.test(url)){return url;}// Lazy feature detection. +if(workingURL===undefined){workingURL=false;try{const u=new URL('b','http://a');u.pathname='c%20d';workingURL=u.href==='http://a/c%20d';}catch(e){// silently fail +}}if(!baseURI){baseURI=document.baseURI||window.location.href;}if(workingURL){return new URL(url,baseURI).href;}// Fallback to creating an anchor into a disconnected document. +if(!resolveDoc){resolveDoc=document.implementation.createHTMLDocument('temp');resolveDoc.base=resolveDoc.createElement('base');resolveDoc.head.appendChild(resolveDoc.base);resolveDoc.anchor=resolveDoc.createElement('a');resolveDoc.body.appendChild(resolveDoc.anchor);}resolveDoc.base.href=baseURI;resolveDoc.anchor.href=url;return resolveDoc.anchor.href||url;}/** + * Resolves any relative URL's in the given CSS text against the provided + * `ownerDocument`'s `baseURI`. + * + * @param {string} cssText CSS text to process + * @param {string} baseURI Base URI to resolve the URL against + * @return {string} Processed CSS text with resolved URL's + */function resolveCss(cssText,baseURI){return cssText.replace(CSS_URL_RX,function(m,pre,url,post){return pre+'\''+resolveUrl(url.replace(/["']/g,''),baseURI)+'\''+post;});}/** + * Returns a path from a given `url`. The path includes the trailing + * `/` from the url. + * + * @param {string} url Input URL to transform + * @return {string} resolved path + */function pathFromUrl(url){return url.substring(0,url.lastIndexOf('/')+1);}var resolveUrl$1={resolveUrl:resolveUrl,resolveCss:resolveCss,pathFromUrl:pathFromUrl};const useShadow=!window.ShadyDOM;const useNativeCSSProperties=Boolean(!window.ShadyCSS||window.ShadyCSS.nativeCss);const useNativeCustomElements=!window.customElements.polyfillWrapFlushCallback;/** + * Globally settable property that is automatically assigned to + * `ElementMixin` instances, useful for binding in templates to + * make URL's relative to an application's root. Defaults to the main + * document URL, but can be overridden by users. It may be useful to set + * `rootPath` to provide a stable application mount path when + * using client side routing. + */let rootPath=undefined||pathFromUrl(document.baseURI||window.location.href);/** + * Sets the global rootPath property used by `ElementMixin` and + * available via `rootPath`. + * + * @param {string} path The new root path + * @return {void} + */const setRootPath=function(path){rootPath=path;};/** + * A global callback used to sanitize any value before inserting it into the DOM. + * The callback signature is: + * + * function sanitizeDOMValue(value, name, type, node) { ... } + * + * Where: + * + * `value` is the value to sanitize. + * `name` is the name of an attribute or property (for example, href). + * `type` indicates where the value is being inserted: one of property, attribute, or text. + * `node` is the node where the value is being inserted. + * + * @type {(function(*,string,string,Node):*)|undefined} + */let sanitizeDOMValue=window.Polymer&&window.Polymer.sanitizeDOMValue||undefined;/** + * Sets the global sanitizeDOMValue available via this module's exported + * `sanitizeDOMValue` variable. + * + * @param {(function(*,string,string,Node):*)|undefined} newSanitizeDOMValue the global sanitizeDOMValue callback + * @return {void} + */const setSanitizeDOMValue=function(newSanitizeDOMValue){sanitizeDOMValue=newSanitizeDOMValue;};/** + * Globally settable property to make Polymer Gestures use passive TouchEvent listeners when recognizing gestures. + * When set to `true`, gestures made from touch will not be able to prevent scrolling, allowing for smoother + * scrolling performance. + * Defaults to `false` for backwards compatibility. + */let passiveTouchGestures=false;/** + * Sets `passiveTouchGestures` globally for all elements using Polymer Gestures. + * + * @param {boolean} usePassive enable or disable passive touch gestures globally + * @return {void} + */const setPassiveTouchGestures=function(usePassive){passiveTouchGestures=usePassive;};/** + * Setting to ensure Polymer template evaluation only occurs based on tempates + * defined in trusted script. When true, `` re-registration is + * disallowed, `` is disabled, and ``/`` + * templates will only evaluate in the context of a trusted element template. + */let strictTemplatePolicy=false;/** + * Sets `strictTemplatePolicy` globally for all elements + * + * @param {boolean} useStrictPolicy enable or disable strict template policy + * globally + * @return {void} + */const setStrictTemplatePolicy=function(useStrictPolicy){strictTemplatePolicy=useStrictPolicy;};/** + * Setting to enable dom-module lookup from Polymer.Element. By default, + * templates must be defined in script using the `static get template()` + * getter and the `html` tag function. To enable legacy loading of templates + * via dom-module, set this flag to true. + */let allowTemplateFromDomModule=false;/** + * Sets `lookupTemplateFromDomModule` globally for all elements + * + * @param {boolean} allowDomModule enable or disable template lookup + * globally + * @return {void} + */const setAllowTemplateFromDomModule=function(allowDomModule){allowTemplateFromDomModule=allowDomModule;};var settings={useShadow:useShadow,useNativeCSSProperties:useNativeCSSProperties,useNativeCustomElements:useNativeCustomElements,get rootPath(){return rootPath;},setRootPath:setRootPath,get sanitizeDOMValue(){return sanitizeDOMValue;},setSanitizeDOMValue:setSanitizeDOMValue,get passiveTouchGestures(){return passiveTouchGestures;},setPassiveTouchGestures:setPassiveTouchGestures,get strictTemplatePolicy(){return strictTemplatePolicy;},setStrictTemplatePolicy:setStrictTemplatePolicy,get allowTemplateFromDomModule(){return allowTemplateFromDomModule;},setAllowTemplateFromDomModule:setAllowTemplateFromDomModule};let dedupeId=0;/** + * @constructor + * @extends {Function} + * @private + */function MixinFunction(){}/** @type {(WeakMap | undefined)} */MixinFunction.prototype.__mixinApplications;/** @type {(Object | undefined)} */MixinFunction.prototype.__mixinSet;/* eslint-disable valid-jsdoc */ /** + * Wraps an ES6 class expression mixin such that the mixin is only applied + * if it has not already been applied its base argument. Also memoizes mixin + * applications. + * + * @template T + * @param {T} mixin ES6 class expression mixin to wrap + * @return {T} + * @suppress {invalidCasts} + */const dedupingMixin=function(mixin){let mixinApplications=/** @type {!MixinFunction} */mixin.__mixinApplications;if(!mixinApplications){mixinApplications=new WeakMap();/** @type {!MixinFunction} */mixin.__mixinApplications=mixinApplications;}// maintain a unique id for each mixin +let mixinDedupeId=dedupeId++;function dedupingMixin(base){let baseSet=/** @type {!MixinFunction} */base.__mixinSet;if(baseSet&&baseSet[mixinDedupeId]){return base;}let map=mixinApplications;let extended=map.get(base);if(!extended){extended=/** @type {!Function} */mixin(base);map.set(base,extended);}// copy inherited mixin set from the extended class, or the base class +// NOTE: we avoid use of Set here because some browser (IE11) +// cannot extend a base Set via the constructor. +let mixinSet=Object.create(/** @type {!MixinFunction} */extended.__mixinSet||baseSet||null);mixinSet[mixinDedupeId]=true;/** @type {!MixinFunction} */extended.__mixinSet=mixinSet;return extended;}return dedupingMixin;};/* eslint-enable valid-jsdoc */var mixin={dedupingMixin:dedupingMixin};let modules={};let lcModules={};/** + * Sets a dom-module into the global registry by id. + * + * @param {string} id dom-module id + * @param {DomModule} module dom-module instance + * @return {void} + */function setModule(id,module){// store id separate from lowercased id so that +// in all cases mixedCase id will stored distinctly +// and lowercase version is a fallback +modules[id]=lcModules[id.toLowerCase()]=module;}/** + * Retrieves a dom-module from the global registry by id. + * + * @param {string} id dom-module id + * @return {DomModule!} dom-module instance + */function findModule(id){return modules[id]||lcModules[id.toLowerCase()];}function styleOutsideTemplateCheck(inst){if(inst.querySelector('style')){console.warn('dom-module %s has style outside template',inst.id);}}/** + * The `dom-module` element registers the dom it contains to the name given + * by the module's id attribute. It provides a unified database of dom + * accessible via its static `import` API. + * + * A key use case of `dom-module` is for providing custom element ``;document.head.appendChild($_documentContainer$7.content);switch(syntax){default:case'mixin':{class SimpleAttributeElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)){static get importMeta(){return bundledImportMeta$b;}static get template(){return(t=>{t.setAttribute("localizable-text","embedded");return t;})(html` + +
+
{{text.ordinary-div}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{model.json-data-id.attr1}} + {{model.json-data-id.i18n-target-attr}} + {{model.template_2:json-data_1.attr1}} + {{model.template_2:json-data_1.i18n-target-attr}} + +
+ + +`);}static get is(){return'simple-attribute-element';}ready(){this.addEventListener('lang-updated',this._langUpdated);super.ready();}connectedCallback(){super.connectedCallback();this._intervalId=window.setInterval(this._checkChartStatus.bind(this),1000);setTimeout(function(){this.isPieChartRendered=true;this.isColumnChartRendered=true;window.clearInterval(this._intervalId);this.fire('local-dom-ready');// TODO: this is an ad-hoc solution +}.bind(this),200);}disconnectedCallback(){super.disconnectedCallback();}_checkChartStatus(){var pieChartInnerHtml=this.$['pie-chart'].$.chartdiv.innerHTML;var columnChartInnerHtml=this.$['column-chart'].$.chartdiv.innerHTML;var notLoaded=false;if(pieChartInnerHtml==='Undefined chart type'){this.isPieChartRendered=true;// google api to blame; this is not responsible +}if(columnChartInnerHtml==='Undefined chart type'){this.isColumnChartRendered=true;// google api to blame; this is not responsible +}if(this.isPieChartRendered&&this.isColumnChartRendered){window.clearInterval(this._intervalId);this.fire('local-dom-ready');}}_langUpdated(e){console.log('_langUpdated');if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);}}_pieChartRendered(){this.isPieChartRendered=true;if(this.isPieChartRendered&&this.isColumnChartRendered){window.clearInterval(this._intervalId);this.fire('local-dom-ready');}}_columnChartRendered(){this.isColumnChartRendered=true;if(this.isPieChartRendered&&this.isColumnChartRendered){window.clearInterval(this._intervalId);this.fire('local-dom-ready');}}}customElements.define(SimpleAttributeElement.is,SimpleAttributeElement);}break;case'base-element':{class SimpleAttributeElement extends BaseElements.I18nElement{static get importMeta(){return bundledImportMeta$b;}static get template(){return(t=>{t.setAttribute("localizable-text","embedded");return t;})(html` + +
+
{{text.ordinary-div}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{model.json-data-id.attr1}} + {{model.json-data-id.i18n-target-attr}} + {{model.template_2:json-data_1.attr1}} + {{model.template_2:json-data_1.i18n-target-attr}} + +
+ + +`);}static get is(){return'simple-attribute-element';}ready(){this.addEventListener('lang-updated',this._langUpdated);super.ready();}connectedCallback(){super.connectedCallback();this._intervalId=window.setInterval(this._checkChartStatus.bind(this),1000);setTimeout(function(){this.isPieChartRendered=true;this.isColumnChartRendered=true;window.clearInterval(this._intervalId);this.fire('local-dom-ready');// TODO: this is an ad-hoc solution +}.bind(this),200);}disconnectedCallback(){super.disconnectedCallback();}_checkChartStatus(){var pieChartInnerHtml=this.$['pie-chart'].$.chartdiv.innerHTML;var columnChartInnerHtml=this.$['column-chart'].$.chartdiv.innerHTML;var notLoaded=false;if(pieChartInnerHtml==='Undefined chart type'){this.isPieChartRendered=true;// google api to blame; this is not responsible +}if(columnChartInnerHtml==='Undefined chart type'){this.isColumnChartRendered=true;// google api to blame; this is not responsible +}if(this.isPieChartRendered&&this.isColumnChartRendered){window.clearInterval(this._intervalId);this.fire('local-dom-ready');}}_langUpdated(e){if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);}}_pieChartRendered(){this.isPieChartRendered=true;if(this.isPieChartRendered&&this.isColumnChartRendered){window.clearInterval(this._intervalId);this.fire('local-dom-ready');}}_columnChartRendered(){this.isColumnChartRendered=true;if(this.isPieChartRendered&&this.isColumnChartRendered){window.clearInterval(this._intervalId);this.fire('local-dom-ready');}}}customElements.define(SimpleAttributeElement.is,SimpleAttributeElement);}break;case'thin':{Define=class SimpleAttributeElement extends BaseElements.I18nElement{static get importMeta(){return bundledImportMeta$b;}ready(){this.addEventListener('lang-updated',this._langUpdated);super.ready();}connectedCallback(){super.connectedCallback();this._intervalId=window.setInterval(this._checkChartStatus.bind(this),1000);setTimeout(function(){this.isPieChartRendered=true;this.isColumnChartRendered=true;window.clearInterval(this._intervalId);this.fire('local-dom-ready');// TODO: this is an ad-hoc solution +}.bind(this),200);}disconnectedCallback(){super.disconnectedCallback();}_checkChartStatus(){var pieChartInnerHtml=this.$['pie-chart'].$.chartdiv.innerHTML;var columnChartInnerHtml=this.$['column-chart'].$.chartdiv.innerHTML;var notLoaded=false;if(pieChartInnerHtml==='Undefined chart type'){this.isPieChartRendered=true;// google api to blame; this is not responsible +}if(columnChartInnerHtml==='Undefined chart type'){this.isColumnChartRendered=true;// google api to blame; this is not responsible +}if(this.isPieChartRendered&&this.isColumnChartRendered){window.clearInterval(this._intervalId);this.fire('local-dom-ready');}}_langUpdated(e){if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);}}_pieChartRendered(){this.isPieChartRendered=true;if(this.isPieChartRendered&&this.isColumnChartRendered){window.clearInterval(this._intervalId);this.fire('local-dom-ready');}}_columnChartRendered(){this.isColumnChartRendered=true;if(this.isPieChartRendered&&this.isColumnChartRendered){window.clearInterval(this._intervalId);this.fire('local-dom-ready');}}};}break;case'legacy':{Polymer$1({importMeta:bundledImportMeta$b,_template:(t=>{t.setAttribute("localizable-text","embedded");return t;})(html` + +
+
{{text.ordinary-div}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{model.json-data-id.attr1}} + {{model.json-data-id.i18n-target-attr}} + {{model.template_2:json-data_1.attr1}} + {{model.template_2:json-data_1.i18n-target-attr}} + +
+ + +`),is:'simple-attribute-element',behaviors:[BehaviorsStore.I18nBehavior],listeners:{'lang-updated':'_langUpdated','pie-chart.google-chart-render':'_pieChartRendered','column-chart.google-chart-render':'_columnChartRendered'},ready:function(){//this.observeHtmlLang = false; +},attached:function(){this._intervalId=window.setInterval(this._checkChartStatus.bind(this),1000);setTimeout(function(){this.isPieChartRendered=true;this.isColumnChartRendered=true;window.clearInterval(this._intervalId);this.fire('local-dom-ready');// TODO: this is an ad-hoc solution +}.bind(this),200);},_checkChartStatus:function(){var pieChartInnerHtml=this.$['pie-chart'].$.chartdiv.innerHTML;var columnChartInnerHtml=this.$['column-chart'].$.chartdiv.innerHTML;var notLoaded=false;if(pieChartInnerHtml==='Undefined chart type'){this.isPieChartRendered=true;// google api to blame; this is not responsible +}if(columnChartInnerHtml==='Undefined chart type'){this.isColumnChartRendered=true;// google api to blame; this is not responsible +}if(this.isPieChartRendered&&this.isColumnChartRendered){window.clearInterval(this._intervalId);this.fire('local-dom-ready');}},_langUpdated:function(e){if(dom(e).rootTarget===this){this.model=deepcopy(this.text.model);}},_pieChartRendered:function(){this.isPieChartRendered=true;if(this.isPieChartRendered&&this.isColumnChartRendered){window.clearInterval(this._intervalId);this.fire('local-dom-ready');}},_columnChartRendered:function(){this.isColumnChartRendered=true;if(this.isPieChartRendered&&this.isColumnChartRendered){window.clearInterval(this._intervalId);this.fire('local-dom-ready');}}});}break;}const bundledImportMeta$c={...import.meta,url:new URL('./fallback-text-element/fallback-text-element.js',import.meta.url).href};const $_documentContainer$8=document.createElement('template');$_documentContainer$8.innerHTML=``;document.head.appendChild($_documentContainer$8.content);switch(syntax){default:case'mixin':{class FallbackTextElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)){static get importMeta(){return bundledImportMeta$c;}static get template(){return(t=>{t.setAttribute("localizable-text","embedded");return t;})(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`);}static get is(){return'fallback-text-element';}ready(){this.addEventListener('lang-updated',this._langUpdated);super.ready();}_langUpdated(e){console.log(this.is,'lang-updated',e.detail);if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);}}}customElements.define(FallbackTextElement.is,FallbackTextElement);}break;case'base-element':{class FallbackTextElement extends BaseElements.I18nElement{static get importMeta(){return bundledImportMeta$c;}static get template(){return(t=>{t.setAttribute("localizable-text","embedded");return t;})(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`);}static get is(){return'fallback-text-element';}ready(){this.addEventListener('lang-updated',this._langUpdated);super.ready();}_langUpdated(e){console.log(this.is,'lang-updated',e.detail);if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);}}}customElements.define(FallbackTextElement.is,FallbackTextElement);}break;case'thin':{Define=class FallbackTextElement extends BaseElements.I18nElement{static get importMeta(){return bundledImportMeta$c;}ready(){this.addEventListener('lang-updated',this._langUpdated);super.ready();}_langUpdated(e){console.log(this.is,'lang-updated',e.detail);if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);}}};}break;case'legacy':{Polymer$1({importMeta:bundledImportMeta$c,_template:(t=>{t.setAttribute("localizable-text","embedded");return t;})(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`),is:'fallback-text-element',behaviors:[BehaviorsStore.I18nBehavior],listeners:{'lang-updated':'_langUpdated'},ready:function(){//this.observeHtmlLang = false; +},attached:function(){},_langUpdated:function(e){console.log(this.is,'lang-updated',e.detail);if(dom(e).rootTarget===this){this.model=deepcopy(this.text.model);}}});}break;}const bundledImportMeta$d={...import.meta,url:new URL('./compound-binding-element/compound-binding-element.js',import.meta.url).href};const $_documentContainer$9=document.createElement('template');$_documentContainer$9.innerHTML=``;document.head.appendChild($_documentContainer$9.content);switch(syntax){default:case'mixin':{class CompoundBindingElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)){static get importMeta(){return bundledImportMeta$d;}static get template(){return(t=>{t.setAttribute("localizable-text","embedded");return t;})(html`{{text.text.0}}{{param1}}{{param2}}
+   +

{{text.h1_3.0}}{{param1}}{{param2}}

{{text.text_4.0}}{{param1}}{{param2}}{{text.span_5.0}}{{param1}}{{param2}} + {{text.span_6.0}}{{param1}}{{param2}} + {{text.label-1.0}}{{param1}}{{param2}} + {{text.label-2.0}}{{param1}}{{param2}} +
+ {{text.div_9:span.0}}{{param1}}{{param2}} + {{text.div_9:span_1.0}}{{param1}}{{param2}} +
{{text.div_9:div_2:div.0}}{{param1}}{{param2}}
+
+
{{text.div_10:text.0}}{{param1}}{{param2}}{{text.div_10:span_1.0}}{{param1}}{{param2}}{{text.div_10:text_2.0}}{{param1}}{{param2}}{{text.div_10:span_3.0}}{{param1}}{{param2}} +
{{text.div_10:div_4:div.0}}{{param1}}{{param2}}
{{text.div_10:text_5.0}}{{param1}}{{param2}}
+
+ {{text.toplevel-div:span.0}}{{param1}}{{param2}} + {{text.toplevel-div:span_1.0}}{{param1}}{{param2}} +
+
{{text.third-level-div.0}}{{param1}}{{param2}}
+
{{text.second-level-div:div_1.0}}{{param1}}{{param2}}
+
+
+
+
    +
  • {{text.div_12:ul:li.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_2.0}}{{param1}}{{param2}}
  • +
+
    +
  • {{text.line-items:li.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_2.0}}{{param1}}{{param2}}
  • +
+
+

{{text.p_13.0}}{{param1}}{{param2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{param1}}{{param2}}{{text.paragraph.4}}

{{text.text_15.0}}{{param1}}{{param2}} +`);}static get is(){return'compound-binding-element';}static get properties(){return{param1:{type:String,value:'parameter 1'},param2:{type:String,value:'parameter 2'}};}ready(){this.addEventListener('lang-updated',this._langUpdated);super.ready();}_langUpdated(e){console.log(this.is,'lang-updated',e.detail);if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);}}}customElements.define(CompoundBindingElement.is,CompoundBindingElement);}break;case'base-element':{class CompoundBindingElement extends BaseElements.I18nElement{static get importMeta(){return bundledImportMeta$d;}static get template(){return(t=>{t.setAttribute("localizable-text","embedded");return t;})(html`{{text.text.0}}{{param1}}{{param2}}
+   +

{{text.h1_3.0}}{{param1}}{{param2}}

{{text.text_4.0}}{{param1}}{{param2}}{{text.span_5.0}}{{param1}}{{param2}} + {{text.span_6.0}}{{param1}}{{param2}} + {{text.label-1.0}}{{param1}}{{param2}} + {{text.label-2.0}}{{param1}}{{param2}} +
+ {{text.div_9:span.0}}{{param1}}{{param2}} + {{text.div_9:span_1.0}}{{param1}}{{param2}} +
{{text.div_9:div_2:div.0}}{{param1}}{{param2}}
+
+
{{text.div_10:text.0}}{{param1}}{{param2}}{{text.div_10:span_1.0}}{{param1}}{{param2}}{{text.div_10:text_2.0}}{{param1}}{{param2}}{{text.div_10:span_3.0}}{{param1}}{{param2}} +
{{text.div_10:div_4:div.0}}{{param1}}{{param2}}
{{text.div_10:text_5.0}}{{param1}}{{param2}}
+
+ {{text.toplevel-div:span.0}}{{param1}}{{param2}} + {{text.toplevel-div:span_1.0}}{{param1}}{{param2}} +
+
{{text.third-level-div.0}}{{param1}}{{param2}}
+
{{text.second-level-div:div_1.0}}{{param1}}{{param2}}
+
+
+
+
    +
  • {{text.div_12:ul:li.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_2.0}}{{param1}}{{param2}}
  • +
+
    +
  • {{text.line-items:li.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_2.0}}{{param1}}{{param2}}
  • +
+
+

{{text.p_13.0}}{{param1}}{{param2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{param1}}{{param2}}{{text.paragraph.4}}

{{text.text_15.0}}{{param1}}{{param2}} +`);}static get is(){return'compound-binding-element';}static get properties(){return{param1:{type:String,value:'parameter 1'},param2:{type:String,value:'parameter 2'}};}ready(){this.addEventListener('lang-updated',this._langUpdated);super.ready();}_langUpdated(e){console.log(this.is,'lang-updated',e.detail);if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);}}}customElements.define(CompoundBindingElement.is,CompoundBindingElement);}break;case'thin':{Define=class CompoundBindingElement extends BaseElements.I18nElement{static get importMeta(){return bundledImportMeta$d;}static get properties(){return{param1:{type:String,value:'parameter 1'},param2:{type:String,value:'parameter 2'}};}ready(){this.addEventListener('lang-updated',this._langUpdated);super.ready();}_langUpdated(e){console.log(this.is,'lang-updated',e.detail);if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);}}};}break;case'legacy':{Polymer$1({importMeta:bundledImportMeta$d,_template:(t=>{t.setAttribute("localizable-text","embedded");return t;})(html`{{text.text.0}}{{param1}}{{param2}}
+   +

{{text.h1_3.0}}{{param1}}{{param2}}

{{text.text_4.0}}{{param1}}{{param2}}{{text.span_5.0}}{{param1}}{{param2}} + {{text.span_6.0}}{{param1}}{{param2}} + {{text.label-1.0}}{{param1}}{{param2}} + {{text.label-2.0}}{{param1}}{{param2}} +
+ {{text.div_9:span.0}}{{param1}}{{param2}} + {{text.div_9:span_1.0}}{{param1}}{{param2}} +
{{text.div_9:div_2:div.0}}{{param1}}{{param2}}
+
+
{{text.div_10:text.0}}{{param1}}{{param2}}{{text.div_10:span_1.0}}{{param1}}{{param2}}{{text.div_10:text_2.0}}{{param1}}{{param2}}{{text.div_10:span_3.0}}{{param1}}{{param2}} +
{{text.div_10:div_4:div.0}}{{param1}}{{param2}}
{{text.div_10:text_5.0}}{{param1}}{{param2}}
+
+ {{text.toplevel-div:span.0}}{{param1}}{{param2}} + {{text.toplevel-div:span_1.0}}{{param1}}{{param2}} +
+
{{text.third-level-div.0}}{{param1}}{{param2}}
+
{{text.second-level-div:div_1.0}}{{param1}}{{param2}}
+
+
+
+
    +
  • {{text.div_12:ul:li.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_2.0}}{{param1}}{{param2}}
  • +
+
    +
  • {{text.line-items:li.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_2.0}}{{param1}}{{param2}}
  • +
+
+

{{text.p_13.0}}{{param1}}{{param2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{param1}}{{param2}}{{text.paragraph.4}}

{{text.text_15.0}}{{param1}}{{param2}} +`),is:'compound-binding-element',behaviors:[BehaviorsStore.I18nBehavior],properties:{param1:{type:String,value:'parameter 1'},param2:{type:String,value:'parameter 2'}},listeners:{'lang-updated':'_langUpdated'},ready:function(){//this.observeHtmlLang = false; +},attached:function(){},_langUpdated:function(e){console.log(this.is,'lang-updated',e.detail);if(dom(e).rootTarget===this){this.model=deepcopy(this.text.model);}}});}break;}const bundledImportMeta$e={...import.meta,url:new URL('./simple-text-id-element/simple-text-id-element.js',import.meta.url).href};const $_documentContainer$a=document.createElement('template');$_documentContainer$a.innerHTML=``;document.head.appendChild($_documentContainer$a.content);switch(syntax){default:case'mixin':{class SimpleTextIdElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)){static get importMeta(){return bundledImportMeta$e;}static get template(){return(t=>{t.setAttribute("localizable-text","embedded");return t;})(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
{{text.second-level-div.0}}
{{text.second-level-div.1}}
{{text.second-level-div.2}}
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    {{text.line-items.0}}
  • {{text.line-items.1}}
  • {{text.line-items.2}}
  • {{text.line-items.3}}
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`);}static get is(){return'simple-text-id-element';}ready(){this.addEventListener('lang-updated',this._langUpdated);super.ready();}_langUpdated(e){console.log(this.is,'lang-updated',e.detail);if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);}}}customElements.define(SimpleTextIdElement.is,SimpleTextIdElement);}break;case'base-element':{class SimpleTextIdElement extends BaseElements.I18nElement{static get importMeta(){return bundledImportMeta$e;}static get template(){return(t=>{t.setAttribute("localizable-text","embedded");return t;})(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
{{text.second-level-div.0}}
{{text.second-level-div.1}}
{{text.second-level-div.2}}
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    {{text.line-items.0}}
  • {{text.line-items.1}}
  • {{text.line-items.2}}
  • {{text.line-items.3}}
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`);}static get is(){return'simple-text-id-element';}ready(){this.addEventListener('lang-updated',this._langUpdated);super.ready();}_langUpdated(e){console.log(this.is,'lang-updated',e.detail);if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);}}}customElements.define(SimpleTextIdElement.is,SimpleTextIdElement);}break;case'thin':{Define=class SimpleTextIdElement extends BaseElements.I18nElement{static get importMeta(){return bundledImportMeta$e;}ready(){this.addEventListener('lang-updated',this._langUpdated);super.ready();}_langUpdated(e){console.log(this.is,'lang-updated',e.detail);if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);}}};}break;case'legacy':{Polymer$1({importMeta:bundledImportMeta$e,_template:(t=>{t.setAttribute("localizable-text","embedded");return t;})(html`{{text.text}}
+   +

{{text.h1_3}}

{{text.text_4}}{{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+
{{text.div_10:text}}{{text.div_10:span_1}}{{text.div_10:text_2}}{{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
{{text.second-level-div.0}}
{{text.second-level-div.1}}
{{text.second-level-div.2}}
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    {{text.line-items.0}}
  • {{text.line-items.1}}
  • {{text.line-items.2}}
  • {{text.line-items.3}}
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} +`),is:'simple-text-id-element',behaviors:[BehaviorsStore.I18nBehavior],listeners:{'lang-updated':'_langUpdated'},ready:function(){//this.observeHtmlLang = false; +},attached:function(){},_langUpdated:function(e){console.log(this.is,'lang-updated',e.detail);if(dom(e).rootTarget===this){this.model=deepcopy(this.text.model);}}});}break;}let intervalId=setInterval(function(){var bind=document.querySelector('#simple-attribute-dom-bind');if(bind){clearInterval(intervalId);}else{return;}bind.addEventListener('dom-change',function onDomChangeForBind(event){if(!bind.done&&event.target===bind){bind._langUpdated=function(e){if(e.composedPath()[0]===this){console.log('bind._langUpdated: '+this.is+' '+this.id+' '+e.type+' '+this.lang+' params.lang = '+(this.params?this.params.lang:''));console.log('bind._langUpdated: deepcopying model for lang '+this.lang);this.model=deepcopy(this.text.model);this.notifyPath('model',this.model);this.render();}}.bind(bind);bind._onDomChangeAfterLangUpdated=function(e){console.log('bind._onDomChangeAfterLangUpdated '+this.is+' '+this.id+' '+e.type+' '+this.lang+' params.lang = '+(this.params?this.params.lang:''));if(this.params&&this.params.lang===this.lang){console.log('bind._onDomChangeAfterLangUpdated '+this.is+' '+this.id+' '+e.type+' firing local-dom-ready');this.fire('local-dom-ready');}e.stopPropagation();return false;}.bind(bind);bind.addEventListener('lang-updated',bind._langUpdated);bind.addEventListener('dom-change',bind._onDomChangeAfterLangUpdated);window.removeEventListener('dom-change',onDomChangeForBind);bind.done=true;}});},10);suite('I18nElement with '+(window.location.href.indexOf('?dom=Shadow')>=0?'Shadow DOM':'Shady DOM')+(' in '+syntax+' syntax'),function(){var lang0='';var lang1='en';var lang2='fr';var lang3='ja';var lang4='fr-CA';var lang5='zh-Hans-CN';var lang6='ru';var text_simple={'model':{},'text':' outermost text at the beginning ','h1_3':'outermost header 1','text_4':' outermost text in the middle ','span_5':'simple text without id','span_6':'simple text without id 2','label-1':'simple text with id','label-2':'simple text with id 2','div_9:span':'simple text within div','div_9:span_1':'simple text within div 2','div_9:div_2:div':'great grandchild text within div','div_10:text':' simple text as the first element in div ','div_10:span_1':'simple text within div','div_10:text_2':' simple text in the middle of div ','div_10:span_3':'simple text within div 2','div_10:div_4:div':'great grandchild text within div','div_10:text_5':' simple text at the last element in div ','toplevel-div:span':'simple text within div','toplevel-div:span_1':'simple text within div 2','third-level-div':'great grandchild text within div','second-level-div:div_1':'great grandchild text within div without id','div_12:ul:li':'line item without id 1','div_12:ul:li_1':'line item without id 2','div_12:ul:li_2':'line item without id 3','line-items:li':'line item with id 1','line-items:li_1':'line item with id 2','line-items:li_2':'line item with id 3','p_13':['A paragraph with {1} is converted to {2}.','parameters',''],'paragraph':['A paragraph with {1} is converted to {2}.','id',''],'text_15':' outermost text at the end '};var localDOM_simple=[{select:'div:not([id])','previousTextSibling.data':' outermost text at the beginning '},{select:'h1',textContent:'outermost header 1'},{select:'h1','nextTextSibling.data':' outermost text in the middle '},{select:'span:not([id])',textContent:['simple text without id','simple text without id 2']},{select:'span[id="label-1"]',textContent:'simple text with id'},{select:'span[id="label-2"]',textContent:'simple text with id 2'},{select:'span[id="label-2"] + div span:not([id])',textContent:['simple text within div','simple text within div 2']},{select:'span[id="label-2"] + div div:not([id]) div:not([id])',textContent:['great grandchild text within div']},{select:'span[id="label-2"] + div + div','childNodes.0.data':' simple text as the first element in div '},{select:'span[id="label-2"] + div + div span:not([id])',textContent:['simple text within div','simple text within div 2']},{select:'span[id="label-2"] + div + div span:not([id])','nextTextSibling.data':' simple text in the middle of div '},{select:'span[id="label-2"] + div + div div:not([id]) div:not([id])',textContent:'great grandchild text within div'},{select:'span[id="label-2"] + div + div div:not([id])','nextTextSibling.data':' simple text at the last element in div '},{select:'[id="toplevel-div"] span:not([id])',textContent:['simple text within div','simple text within div 2']},{select:'[id="third-level-div"]',textContent:'great grandchild text within div'},{select:'[id="second-level-div"] div:not([id])',textContent:'great grandchild text within div without id'},{select:'div ul:not([id]) li:not([id])',textContent:['line item without id 1','line item without id 2','line item without id 3']},{select:'[id="line-items"] li:not([id])',textContent:['line item with id 1','line item with id 2','line item with id 3']},{select:'p:not([id]) i18n-format','PolymerDom.children.0.textContent':'A paragraph with {1} is converted to {2}.'},{select:'p:not([id]) i18n-format','PolymerDom.children.1.tagName':'B','PolymerDom.children.1.textContent':'parameters','PolymerDom.children.1.attributes.slot.value':'1'},{select:'p:not([id]) i18n-format','PolymerDom.children.2.tagName':'CODE','PolymerDom.children.2.textContent':'','PolymerDom.children.2.attributes.slot.value':'2'},{select:'[id="paragraph"] i18n-format','PolymerDom.children.0.textContent':'A paragraph with {1} is converted to {2}.'},{select:'[id="paragraph"] i18n-format','PolymerDom.children.1.tagName':'B','PolymerDom.children.1.textContent':'id','PolymerDom.children.1.attributes.slot.value':'1'},{select:'[id="paragraph"] i18n-format','PolymerDom.children.2.tagName':'CODE','PolymerDom.children.2.textContent':'','PolymerDom.children.2.attributes.slot.value':'2'},{select:'[id="paragraph"]','nextTextSibling.data':' outermost text at the end '}];var text_simple_text_id={'model':{},'text':' outermost text at the beginning ','h1_3':'outermost header 1','text_4':' outermost text in the middle ','span_5':'simple text without id','span_6':'simple text without id 2','label-1':'simple text with id','label-2':'simple text with id 2','div_9:span':'simple text within div','div_9:span_1':'simple text within div 2','div_9:div_2:div':'great grandchild text within div','div_10:text':' simple text as the first element in div ','div_10:span_1':'simple text within div','div_10:text_2':' simple text in the middle of div ','div_10:span_3':'simple text within div 2','div_10:div_4:div':'great grandchild text within div','div_10:text_5':' simple text at the last element in div ','toplevel-div:span':'simple text within div','toplevel-div:span_1':'simple text within div 2','second-level-div':[' {1}\n {2} ','great grandchild text within div','great grandchild text within div without id'],'div_12:ul:li':'line item without id 1','div_12:ul:li_1':'line item without id 2','div_12:ul:li_2':'line item without id 3','line-items':[' {1}\n {2}\n {3} ','line item with id 1','line item with id 2','line item with id 3'],'p_13':['A paragraph with {1} is converted to {2}.','parameters',''],'paragraph':['A paragraph with {1} is converted to {2}.','id',''],'text_15':' outermost text at the end '};var localDOM_simple_text_id=[{select:'div:not([text-id])','previousTextSibling.data':' outermost text at the beginning '},{select:'h1',textContent:'outermost header 1'},{select:'h1','nextTextSibling.data':' outermost text in the middle '},{select:'span:not([text-id])',textContent:['simple text without id','simple text without id 2']},{select:'span[text-id="label-1"]',textContent:'simple text with id'},{select:'span[text-id="label-2"]',textContent:'simple text with id 2'},{select:'span[text-id="label-2"] + div span:not([text-id])',textContent:['simple text within div','simple text within div 2']},{select:'span[text-id="label-2"] + div div:not([text-id]) div:not([text-id])',textContent:['great grandchild text within div']},{select:'span[text-id="label-2"] + div + div','childNodes.0.data':' simple text as the first element in div '},{select:'span[text-id="label-2"] + div + div span:not([text-id])',textContent:['simple text within div','simple text within div 2']},{select:'span[text-id="label-2"] + div + div span:not([text-id])','nextTextSibling.data':' simple text in the middle of div '},{select:'span[text-id="label-2"] + div + div div:not([text-id]) div:not([text-id])',textContent:'great grandchild text within div'},{select:'span[text-id="label-2"] + div + div div:not([text-id])','nextTextSibling.data':' simple text at the last element in div '},{select:'[text-id="toplevel-div"] span:not([text-id])',textContent:['simple text within div','simple text within div 2']},{select:'[text-id="second-level-div"] i18n-format','PolymerDom.children.0.textContent':' {1}\n {2} '},{select:'[text-id="second-level-div"] i18n-format','PolymerDom.children.1.tagName':'DIV','PolymerDom.children.1.textContent':'great grandchild text within div','PolymerDom.children.1.attributes.slot.value':'1'},{select:'[text-id="second-level-div"] i18n-format','PolymerDom.children.2.tagName':'DIV','PolymerDom.children.2.textContent':'great grandchild text within div without id','PolymerDom.children.2.attributes.slot.value':'2'},{select:'div ul:not([text-id]) li:not([text-id])',textContent:['line item without id 1','line item without id 2','line item without id 3']},{select:'[text-id="line-items"] i18n-format','PolymerDom.children.0.textContent':' {1}\n {2}\n {3} '},{select:'[text-id="line-items"] i18n-format','PolymerDom.children.1.tagName':'LI','PolymerDom.children.1.textContent':'line item with id 1','PolymerDom.children.1.attributes.slot.value':'1'},{select:'[text-id="line-items"] i18n-format','PolymerDom.children.2.tagName':'LI','PolymerDom.children.2.textContent':'line item with id 2','PolymerDom.children.2.attributes.slot.value':'2'},{select:'[text-id="line-items"] i18n-format','PolymerDom.children.3.tagName':'LI','PolymerDom.children.3.textContent':'line item with id 3','PolymerDom.children.3.attributes.slot.value':'3'},{select:'p:not([text-id]) i18n-format','PolymerDom.children.0.textContent':'A paragraph with {1} is converted to {2}.'},{select:'p:not([text-id]) i18n-format','PolymerDom.children.1.tagName':'B','PolymerDom.children.1.textContent':'parameters','PolymerDom.children.1.attributes.slot.value':'1'},{select:'p:not([text-id]) i18n-format','PolymerDom.children.2.tagName':'CODE','PolymerDom.children.2.textContent':'','PolymerDom.children.2.attributes.slot.value':'2'},{select:'[text-id="paragraph"] i18n-format','PolymerDom.children.0.textContent':'A paragraph with {1} is converted to {2}.'},{select:'[text-id="paragraph"] i18n-format','PolymerDom.children.1.tagName':'B','PolymerDom.children.1.textContent':'id','PolymerDom.children.1.attributes.slot.value':'1'},{select:'[text-id="paragraph"] i18n-format','PolymerDom.children.2.tagName':'CODE','PolymerDom.children.2.textContent':'','PolymerDom.children.2.attributes.slot.value':'2'},{select:'[text-id="paragraph"]','nextTextSibling.data':' outermost text at the end '}];var sender1={'name':'Joe','gender':'male'};var recipients1=[{'name':'Alice','gender':'female'},{'name':'Bob','gender':'male'},{'name':'Yoda','gender':'other'}];var recipients2=[{'name':'Alice','gender':'female'},{'name':'Bob','gender':'male'}];var recipients3=[{'name':'Bob','gender':'male'}];var recipients4=[];var text_plural_gender={'model':{},'compound-format-text':[{'0':'You ({3}) gave no gifts.','1':{'male':'You ({3}) gave him ({4}) {5}.','female':'You ({3}) gave her ({4}) {5}.','other':'You ({3}) gave them ({4}) {5}.'},'one':{'male':'You ({3}) gave him ({4}) and one other person {5}.','female':'You ({3}) gave her ({4}) and one other person {5}.','other':'You ({3}) gave them ({4}) and one other person {5}.'},'other':'You ({3}) gave them ({4}) and {1} other people gifts.'},'{{recipients.length - 1}}','{{recipients.0.gender}}','{{sender.name}}','{{recipients.0.name}}','a gift']};var localDOM_plural_gender_1=[{select:'#compound-format-text','root.PolymerDom.textContent':'You () gave them () and other people gifts.'},{select:'#compound-format-text','PolymerDom.children.1.PolymerDom.childNodes.0.data.raw':'3'},{select:'#compound-format-text','PolymerDom.children.2.PolymerDom.childNodes.0.data.raw':'female'},{select:'#compound-format-text','PolymerDom.children.3.PolymerDom.childNodes.0.data.raw':'Joe'},{select:'#compound-format-text','PolymerDom.children.4.PolymerDom.childNodes.0.data.raw':'Alice'},{select:'#compound-format-text','PolymerDom.children.5.PolymerDom.childNodes.0.data':'a gift'}];var localDOM_plural_gender_2=[{select:'#compound-format-text','root.PolymerDom.textContent':'You () gave her () and one other person .'},{select:'#compound-format-text','PolymerDom.children.1.PolymerDom.childNodes.0.data.raw':'2'},{select:'#compound-format-text','PolymerDom.children.2.PolymerDom.childNodes.0.data.raw':'female'},{select:'#compound-format-text','PolymerDom.children.3.PolymerDom.childNodes.0.data.raw':'Joe'},{select:'#compound-format-text','PolymerDom.children.4.PolymerDom.childNodes.0.data.raw':'Alice'},{select:'#compound-format-text','PolymerDom.children.5.PolymerDom.childNodes.0.data':'a gift'}];var localDOM_plural_gender_3=[{select:'#compound-format-text','root.PolymerDom.textContent':'You () gave him () .'},{select:'#compound-format-text','PolymerDom.children.1.PolymerDom.childNodes.0.data.raw':'1'},{select:'#compound-format-text','PolymerDom.children.2.PolymerDom.childNodes.0.data.raw':'male'},{select:'#compound-format-text','PolymerDom.children.3.PolymerDom.childNodes.0.data.raw':'Joe'},{select:'#compound-format-text','PolymerDom.children.4.PolymerDom.childNodes.0.data.raw':'Bob'},{select:'#compound-format-text','PolymerDom.children.5.PolymerDom.childNodes.0.data':'a gift'}];var localDOM_plural_gender_4=[{select:'#compound-format-text','root.PolymerDom.textContent':'You () gave no gifts.'},{select:'#compound-format-text','PolymerDom.children.1.PolymerDom.childNodes.0.data.raw':'0'},{select:'#compound-format-text','PolymerDom.children.2.PolymerDom.childNodes.0.data.raw':''},{select:'#compound-format-text','PolymerDom.children.3.PolymerDom.childNodes.0.data.raw':'Joe'},{select:'#compound-format-text','PolymerDom.children.4.PolymerDom.childNodes.0.data.raw':''},{select:'#compound-format-text','PolymerDom.children.5.PolymerDom.childNodes.0.data':'a gift'}];var text_simple_attribute={'model':{'standard-input':{'placeholder':'standard HTML5 attribute'},'outer-div:input_2':{'placeholder':'standard HTML5 attribute without id'},'paper-input-element':{'label':'paper-input label','error-message':'paper-input error message','placeholder':'paper-input placeholder'},'outer-div:paper-input_4':{'label':'paper-input label without id','error-message':'paper-input error message without id','placeholder':'paper-input placeholder without id'},'pie-chart':{'options':{'title':'Distribution of days in 2001H1'},'cols':[{'label':'Month','type':'string'},{'label':'Days','type':'number'}],'rows':[['Jan',31],['Feb',28],['Mar',31],['Apr',30],['May',31],['Jun',30]]},'column-chart':{'options':{'title':'Inventory'},'data':[['Year','Things','Stuff'],['2004',1000,400],['2005',1170,460],['2006',660,1120],['2007',1030,540]]},'custom-attr':{'custom-text-attr1':'custom text attribute 1','custom-text-attr2':'custom text attribute 2','custom-text-attr3':'custom text attribute 3'},'selective-attr':{'custom-text-attr4':['{1} custom-text-attr4 attribute with param {2} and param {3} {4}','{{text.ordinary-div}}','{{text.ordinary-div}}','[[text.ordinary-div]]','{{text.ordinary-div}}'],'custom-text-attr5':['[[text.ordinary-div]]',' custom-text-attr5 attribute with param ',"{{or('',text.ordinary-div)}}",' and param ','[[text.ordinary-div]]'],'i18n-target':['i18n-target attribute with param {1} and param {2}','{{text.ordinary-div}}','[[text.ordinary-div]]'],'i18n-target2':['i18n-target2 attribute with param ',"{{or('',text.ordinary-div)}}",' and param ','[[text.ordinary-div]]']},'selective-attr2':{'i18n-target':'i18n-target attribute 2'},'selective-attr3':{'i18n-target6':'i18n-target6 attribute 2'},'selective-attr4':{'i18n-target6':'i18n-target6 attribute 3'},'json-data-id':{'attr1':'this attr1 is extracted','i18n-target-attr':'this attribute is also extracted'},'template_2:json-data_1':{'attr1':'this attr1 without id is extracted','i18n-target-attr':'this attribute without id is also extracted'}},'ordinary-div':'text 1'};var model_simple_attribute={'standard-input':{'placeholder':'standard HTML5 attribute'},'outer-div:input_2':{'placeholder':'standard HTML5 attribute without id'},'paper-input-element':{'label':'paper-input label','error-message':'paper-input error message','placeholder':'paper-input placeholder'},'outer-div:paper-input_4':{'label':'paper-input label without id','error-message':'paper-input error message without id','placeholder':'paper-input placeholder without id'},'pie-chart':{'options':{'title':'Distribution of days in 2001H1'},'cols':[{'label':'Month','type':'string'},{'label':'Days','type':'number'}],'rows':[['Jan',31],['Feb',28],['Mar',31],['Apr',30],['May',31],['Jun',30]]},'column-chart':{'options':{'title':'Inventory'},'data':[['Year','Things','Stuff'],['2004',1000,400],['2005',1170,460],['2006',660,1120],['2007',1030,540]]},'custom-attr':{'custom-text-attr1':'custom text attribute 1','custom-text-attr2':'custom text attribute 2','custom-text-attr3':'custom text attribute 3'},'selective-attr':{'custom-text-attr4':['{1} custom-text-attr4 attribute with param {2} and param {3} {4}','{{text.ordinary-div}}','{{text.ordinary-div}}','[[text.ordinary-div]]','{{text.ordinary-div}}'],'custom-text-attr5':['[[text.ordinary-div]]',' custom-text-attr5 attribute with param ',"{{or('',text.ordinary-div)}}",' and param ','[[text.ordinary-div]]'],'i18n-target':['i18n-target attribute with param {1} and param {2}','{{text.ordinary-div}}','[[text.ordinary-div]]'],'i18n-target2':['i18n-target2 attribute with param ',"{{or('',text.ordinary-div)}}",' and param ','[[text.ordinary-div]]']},'selective-attr2':{'i18n-target':'i18n-target attribute 2'},'selective-attr3':{'i18n-target6':'i18n-target6 attribute 2'},'selective-attr4':{'i18n-target6':'i18n-target6 attribute 3'},'json-data-id':{'attr1':'this attr1 is extracted','i18n-target-attr':'this attribute is also extracted'},'template_2:json-data_1':{'attr1':'this attr1 without id is extracted','i18n-target-attr':'this attribute without id is also extracted'}};var localDOM_simple_attribute=[{select:'input[id="standard-input"]','placeholder.text':'standard HTML5 attribute'},{select:'input[id="standard-input"] + input','placeholder.text':'standard HTML5 attribute without id'},{select:'paper-input[id="paper-input-element"]','label.text':'paper-input label','errorMessage.text':'paper-input error message','placeholder.text':'paper-input placeholder'},{select:'paper-input[id="paper-input-element"] + paper-input','label.text':'paper-input label without id','errorMessage.text':'paper-input error message without id','placeholder.text':'paper-input placeholder without id'},{select:'google-chart[id="pie-chart"]','options.title.text':'Distribution of days in 2001H1','cols.0.label.text':'Month','cols.1.label.text':'Days','rows.0.0.text':'Jan','rows.1.0.text':'Feb','rows.2.0.text':'Mar','rows.3.0.text':'Apr','rows.4.0.text':'May','rows.5.0.text':'Jun'},{select:'google-chart[id="column-chart"]','options.title.text':'Inventory','data.0.0.text':'Year','data.0.1.text':'Things','data.0.2.text':'Stuff'},{select:'text-attribute-element[id="custom-attr"]','customTextAttr1.text':'custom text attribute 1','customTextAttr2.text':'custom text attribute 2','customTextAttr3.text':'custom text attribute 3'},{select:'text-attribute-element[id="selective-attr"]','i18nTarget.raw':'i18n-target attribute with param text 1 and param text 1','i18nTarget2.raw':'i18n-target2 attribute with param text 1 and param text 1'},{select:'span[id="test-json-data-1"]','textContent':'this attr1 is extracted'},{select:'span[id="test-json-data-2"]','textContent':'this attribute is also extracted'},{select:'span[id="test-json-data-3"]','textContent':'this attr1 without id is extracted'},{select:'span[id="test-json-data-4"]','textContent':'this attribute without id is also extracted'}];var localDOM_simple_attribute_fr=[{select:'input[id="standard-input"]','placeholder.text':'standard HTML5 attribute'},{select:'input[id="standard-input"] + input','placeholder.text':'standard HTML5 attribute without id'},{select:'paper-input[id="paper-input-element"]','label.text':'paper-input label','errorMessage.text':'paper-input error message','placeholder.text':'paper-input placeholder'},{select:'paper-input[id="paper-input-element"] + paper-input','label.text':'paper-input label without id','errorMessage.text':'paper-input error message without id','placeholder.text':'paper-input placeholder without id'},{select:'google-chart[id="pie-chart"]','options.title.text':'Distribution of days in 2001H1','cols.0.label.text':'Month','cols.1.label.text':'Days','rows.0.0.text':'Jan','rows.1.0.text':'Feb','rows.2.0.text':'Mar','rows.3.0.text':'Apr','rows.4.0.text':'May','rows.5.0.text':'Jun'},{select:'google-chart[id="column-chart"]','options.title.text':'Inventory','data.0.0.text':'Year','data.0.1.text':'Things','data.0.2.text':'Stuff'},{select:'text-attribute-element[id="custom-attr"]','customTextAttr1.text':'custom text attribute 1','customTextAttr2.text':'custom text attribute 2','customTextAttr3.text':'custom text attribute 3'},{select:'text-attribute-element[id="selective-attr"]','i18nTarget.raw':'fr i18n-target attribute with param fr text 1 and param fr text 1','i18nTarget2.raw':'fr i18n-target2 attribute with param fr text 1 fr and param fr text 1'},{select:'span[id="test-json-data-1"]','textContent':'this attr1 is extracted'},{select:'span[id="test-json-data-2"]','textContent':'this attribute is also extracted'},{select:'span[id="test-json-data-3"]','textContent':'this attr1 without id is extracted'},{select:'span[id="test-json-data-4"]','textContent':'this attribute without id is also extracted'}];var text_fallback={'model':{},'text':'fr-CA outermost text at the beginning ','h1_3':'fr-CA outermost header 1','text_4':'fr-CA outermost text in the middle ','span_5':'fr-CA simple text without id','span_6':'fr-CA simple text without id 2','label-1':'fr-CA simple text with id','label-2':'fr-CA simple text with id 2','div_9:span':'simple text within div','div_9:span_1':'simple text within div 2','div_9:div_2:div':'great grandchild text within div','div_10:text':' simple text as the first element in div ','div_10:span_1':'fr-CA simple text within div','div_10:text_2':' simple text in the middle of div ','div_10:span_3':'simple text within div 2','div_10:div_4:div':'great grandchild text within div','div_10:text_5':' simple text at the last element in div ','toplevel-div:span':'fr-CA simple text within div','toplevel-div:span_1':'fr-CA simple text within div 2','third-level-div':'fr-CA great grandchild text within div','second-level-div:div_1':'fr-CA great grandchild text within div without id','div_12:ul:li':'fr line item without id 1','div_12:ul:li_1':'fr line item without id 2','div_12:ul:li_2':'fr line item without id 3','line-items:li':'fr line item with id 1','line-items:li_1':'fr line item with id 2','line-items:li_2':'fr line item with id 3','p_13':['fr-CA A paragraph with {1} is converted to {2}.','fr-CA parameters','fr-CA '],'paragraph':['fr-CA A paragraph with {1} is converted to {2}.','fr-CA id','fr-CA '],'text_15':'fr-CA outermost text at the end '};var localDOM_fallback=[{select:'div:not([id])','previousTextSibling.data':'fr-CA outermost text at the beginning '},{select:'h1',textContent:'fr-CA outermost header 1'},{select:'h1','nextTextSibling.data':'fr-CA outermost text in the middle '},{select:'span:not([id])',textContent:['fr-CA simple text without id','fr-CA simple text without id 2']},{select:'span[id="label-1"]',textContent:'fr-CA simple text with id'},{select:'span[id="label-2"]',textContent:'fr-CA simple text with id 2'},{select:'span[id="label-2"] + div span:not([id])',textContent:['simple text within div','simple text within div 2']},{select:'span[id="label-2"] + div div:not([id]) div:not([id])',textContent:['great grandchild text within div']},{select:'span[id="label-2"] + div + div','childNodes.0.data':' simple text as the first element in div '},{select:'span[id="label-2"] + div + div span:not([id])',textContent:['fr-CA simple text within div','simple text within div 2']},{select:'span[id="label-2"] + div + div span:not([id])','nextTextSibling.data':' simple text in the middle of div '},{select:'span[id="label-2"] + div + div div:not([id]) div:not([id])',textContent:'great grandchild text within div'},{select:'span[id="label-2"] + div + div div:not([id])','nextTextSibling.data':' simple text at the last element in div '},{select:'[id="toplevel-div"] span:not([id])',textContent:['fr-CA simple text within div','fr-CA simple text within div 2']},{select:'[id="third-level-div"]',textContent:'fr-CA great grandchild text within div'},{select:'[id="second-level-div"] div:not([id])',textContent:'fr-CA great grandchild text within div without id'},{select:'div ul:not([id]) li:not([id])',textContent:['fr line item without id 1','fr line item without id 2','fr line item without id 3']},{select:'[id="line-items"] li:not([id])',textContent:['fr line item with id 1','fr line item with id 2','fr line item with id 3']},{select:'p:not([id]) i18n-format','PolymerDom.children.0.textContent':'fr-CA A paragraph with {1} is converted to {2}.'},{select:'p:not([id]) i18n-format','PolymerDom.children.1.tagName':'B','PolymerDom.children.1.textContent':'fr-CA parameters','PolymerDom.children.1.attributes.slot.value':'1'},{select:'p:not([id]) i18n-format','PolymerDom.children.2.tagName':'CODE','PolymerDom.children.2.textContent':'fr-CA ','PolymerDom.children.2.attributes.slot.value':'2'},{select:'[id="paragraph"] i18n-format','PolymerDom.children.0.textContent':'fr-CA A paragraph with {1} is converted to {2}.'},{select:'[id="paragraph"] i18n-format','PolymerDom.children.1.tagName':'B','PolymerDom.children.1.textContent':'fr-CA id','PolymerDom.children.1.attributes.slot.value':'1'},{select:'[id="paragraph"] i18n-format','PolymerDom.children.2.tagName':'CODE','PolymerDom.children.2.textContent':'fr-CA ','PolymerDom.children.2.attributes.slot.value':'2'},{select:'[id="paragraph"]','nextTextSibling.data':'fr-CA outermost text at the end '}];var param1='1st compound parameter';var param2='2nd compound parameter';var text_compound={'model':{},'text':[' outermost text at the beginning with compound {1} and {2} variables ','{{param1}}','{{param2}}'],'h1_3':['outermost header 1 with {1} and {2} variables','{{param1}}','{{param2}}'],'text_4':[' outermost text in the middle with {1} and {2} variables ','{{param1}}','{{param2}}'],'span_5':['simple text without id with {1} and {2} variables','{{param1}}','{{param2}}'],'span_6':['simple text without id 2 with {1} and {2} variables','{{param1}}','{{param2}}'],'label-1':['simple text with id and {1} and {2} variables','{{param1}}','{{param2}}'],'label-2':['simple text with id and {1} and {2} variables 2','{{param1}}','{{param2}}'],'div_9:span':['simple text within div with {1} and {2} variables','{{param1}}','{{param2}}'],'div_9:span_1':['simple text within div with {1} and {2} variables 2','{{param1}}','{{param2}}'],'div_9:div_2:div':['great grandchild text within div with {1} and {2} variables','{{param1}}','{{param2}}'],'div_10:text':[' simple text as the first element in div with {1} and {2} variables ','{{param1}}','{{param2}}'],'div_10:span_1':['simple text within div with {1} and {2} variables','{{param1}}','{{param2}}'],'div_10:text_2':[' simple text in the middle of div with {1} and {2} variables ','{{param1}}','{{param2}}'],'div_10:span_3':['simple text within div with {1} and {2} variables 2','{{param1}}','{{param2}}'],'div_10:div_4:div':['great grandchild text within div with {1} and {2} variables','{{param1}}','{{param2}}'],'div_10:text_5':[' simple text at the last element in div with {1} and {2} variables ','{{param1}}','{{param2}}'],'toplevel-div:span':['simple text within div with {1} and {2} variables','{{param1}}','{{param2}}'],'toplevel-div:span_1':['simple text within div 2 with {1} and {2} variables','{{param1}}','{{param2}}'],'third-level-div':['great grandchild text within div with {1} and {2} variables','{{param1}}','{{param2}}'],'second-level-div:div_1':['great grandchild text within div without id with {1} and {2} variables','{{param1}}','{{param2}}'],'div_12:ul:li':['line item without id 1 with {1} and {2} variables','{{param1}}','{{param2}}'],'div_12:ul:li_1':['line item without id 2 with {1} and {2} variables','{{param1}}','{{param2}}'],'div_12:ul:li_2':['line item without id 3 with {1} and {2} variables','{{param1}}','{{param2}}'],'line-items:li':['line item with id 1 with {1} and {2} variables','{{param1}}','{{param2}}'],'line-items:li_1':['line item with id 2 with {1} and {2} variables','{{param1}}','{{param2}}'],'line-items:li_2':['line item with id 3 with {1} and {2} variables','{{param1}}','{{param2}}'],'p_13':['A paragraph with {1} is converted to {2}.','{{param1}}','{{param2}}'],'paragraph':['A paragraph with {1}, {2}, and {3} is converted to {4}.','id','{{param1}}','{{param2}}',''],'text_15':[' outermost text at the end with {1} and {2} variables ','{{param1}}','{{param2}}']};var localDOM_compound=[{select:'i18n-format','PolymerDom.children.0.textContent':[' outermost text at the beginning with compound {1} and {2} variables ','outermost header 1 with {1} and {2} variables',' outermost text in the middle with {1} and {2} variables ','simple text without id with {1} and {2} variables','simple text without id 2 with {1} and {2} variables','simple text with id and {1} and {2} variables','simple text with id and {1} and {2} variables 2','simple text within div with {1} and {2} variables','simple text within div with {1} and {2} variables 2','great grandchild text within div with {1} and {2} variables',' simple text as the first element in div with {1} and {2} variables ','simple text within div with {1} and {2} variables',' simple text in the middle of div with {1} and {2} variables ','simple text within div with {1} and {2} variables 2','great grandchild text within div with {1} and {2} variables',' simple text at the last element in div with {1} and {2} variables ','simple text within div with {1} and {2} variables','simple text within div 2 with {1} and {2} variables','great grandchild text within div with {1} and {2} variables','great grandchild text within div without id with {1} and {2} variables','line item without id 1 with {1} and {2} variables','line item without id 2 with {1} and {2} variables','line item without id 3 with {1} and {2} variables','line item with id 1 with {1} and {2} variables','line item with id 2 with {1} and {2} variables','line item with id 3 with {1} and {2} variables','A paragraph with {1} is converted to {2}.','A paragraph with {1}, {2}, and {3} is converted to {4}.',' outermost text at the end with {1} and {2} variables '],'PolymerDom.children.1.textContent.raw':['1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter','1st compound parameter'],'PolymerDom.children.2.textContent.raw':['2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','2nd compound parameter','1st compound parameter','2nd compound parameter']},{select:'[id="paragraph"] i18n-format','PolymerDom.children.1.tagName':'B','PolymerDom.children.1.textContent':'id','PolymerDom.children.1.attributes.slot.value.raw':'1','PolymerDom.children.3.tagName':'SPAN','PolymerDom.children.3.textContent.raw':'2nd compound parameter','PolymerDom.children.3.attributes.slot.value.raw':'3'},{select:'[id="paragraph"] +i18n-format','PolymerDom.children.1.textContent.raw':'1st compound parameter'}];var suites=[s('simple text default',null,{fixture:'simple-text-element-default-fixture',fixtureModel:undefined,assign:undefined,lang:lang1,effectiveLang:lang1,templateDefaultLang:lang1,observeHtmlLang:true,text:text_simple,model:{},localDOM:localDOM_simple,lightDOM:undefined}),s('commented simple text default','simple text default',{fixture:'commented-simple-text-element-default-fixture'}),s('simple text default null lang','simple text default',{assign:{lang:lang0},lang:lang0,effectiveLang:lang0}),s('commented simple text default null lang','commented simple text default',{assign:{lang:lang0},lang:lang0,effectiveLang:lang0}),s(lang2+' simple text default','simple text default',{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s(lang2+' commented simple text default','commented simple text default',{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s('simple text null lang','simple text default',{fixture:'simple-text-element-fixture',fixtureModel:{observeHtmlLang:false,lang:lang0},assign:{lang:lang0},lang:lang0,effectiveLang:lang0,observeHtmlLang:false}),s('simple text','simple text null lang',{assign:{lang:lang1},lang:lang1,effectiveLang:lang1}),s(lang2+' simple text','simple text',{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s(lang6+' simple text','simple text',{assign:{lang:lang6},lang:lang6,effectiveLang:lang6}),s('commented simple text','simple text',{fixture:'commented-simple-text-element-fixture'}),s('commented simple text null lang','commented simple text',{assign:{lang:lang0},lang:lang0,effectiveLang:lang0}),s(lang2+' commented simple text','commented simple text',{fixtureModel:{observeHtmlLang:false,lang:lang0},assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s(lang2+' static commented simple text','commented simple text',{fixtureModel:{observeHtmlLang:false,lang:lang2},assign:undefined,lang:lang2,effectiveLang:lang2}),s('simple text id','simple text',{fixture:'simple-text-id-element-fixture',text:text_simple_text_id,localDOM:localDOM_simple_text_id}),s(lang2+' simple text id','simple text id',{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s('plural gender','simple text default',{fixture:'plural-gender-element-fixture',fixtureModel:{observeHtmlLang:false,lang:lang0},assign:{lang:lang1,sender:sender1,recipients:recipients1},observeHtmlLang:false,event:'local-dom-ready',text:text_plural_gender,localDOM:localDOM_plural_gender_1}),s('plural gender 2','plural gender',{assign:{lang:lang1,sender:sender1,recipients:recipients2},localDOM:localDOM_plural_gender_2}),s('plural gender 3','plural gender',{assign:{lang:lang1,sender:sender1,recipients:recipients3},localDOM:localDOM_plural_gender_3}),s('plural gender 4','plural gender',{assign:{lang:lang1,sender:sender1,recipients:recipients4},localDOM:localDOM_plural_gender_4}),s(lang2+' plural gender','plural gender',{assign:{lang:lang2,sender:sender1,recipients:recipients1},lang:lang2,effectiveLang:lang2}),s(lang2+' plural gender 2','plural gender 2',{assign:{lang:lang2,sender:sender1,recipients:recipients2},lang:lang2,effectiveLang:lang2,localDOM:localDOM_plural_gender_2}),s(lang2+' plural gender 3','plural gender 3',{assign:{lang:lang2,sender:sender1,recipients:recipients3},lang:lang2,effectiveLang:lang2,localDOM:localDOM_plural_gender_3}),s(lang2+' plural gender 4','plural gender 4',{assign:{lang:lang2,sender:sender1,recipients:recipients4},lang:lang2,effectiveLang:lang2,localDOM:localDOM_plural_gender_4}),s('simple attribute','simple text default',{fixture:'simple-attribute-element-fixture',fixtureModel:{observeHtmlLang:false,lang:lang0},assign:{lang:lang1},observeHtmlLang:false,text:text_simple_attribute,model:model_simple_attribute,localDOM:localDOM_simple_attribute}),s(lang2+' simple attribute','simple attribute',{assign:{lang:lang2},lang:lang2,effectiveLang:lang2,localDOM:localDOM_simple_attribute_fr}),s(lang4+' simple text default with fallback to '+lang2,'simple text default',{timeout:60000,assign:{lang:lang4},lang:lang2,effectiveLang:lang2}),s(lang4+' simple text with fallback to '+lang2,'simple text',{timeout:60000,assign:{lang:lang4},lang:lang2,effectiveLang:lang2}),s(lang5+' simple text with fallback to default','simple text',{timeout:60000,assign:{lang:lang5},lang:lang0,effectiveLang:lang0}),s(lang3+' simple text with fallback to default','simple text',{timeout:60000,assign:{lang:lang3},lang:lang0,effectiveLang:lang0}),s(lang4+' fallback text','simple text',{timeout:60000,fixture:'fallback-text-element-fixture',assign:{lang:lang4},lang:lang4,effectiveLang:lang4,rawText:true,text:text_fallback,localDOM:localDOM_fallback}),s('compound binding','simple text',{fixture:'compound-binding-element-fixture',fixtureModel:{observeHtmlLang:false,lang:lang0,param1:param1,param2:param2},text:text_compound,localDOM:localDOM_compound}),s(lang2+' compound binding','compound binding',{fixtureModel:{observeHtmlLang:false,lang:lang0,param1:param1,param2:param2},assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s('simple attribute dom bind','simple attribute',{fixture:'simple-attribute-dom-bind',fixtureModel:{observeHtmlLang:false,lang:lang0},assign:{lang:lang1},event:'local-dom-ready',text:text_simple_attribute,model:model_simple_attribute,localDOM:localDOM_simple_attribute}),s(lang2+' simple attribute dom bind','simple attribute dom bind',{fixtureModel:{observeHtmlLang:false,lang:lang0},assign:{lang:lang2},lang:lang2,effectiveLang:lang2,localDOM:localDOM_simple_attribute_fr}),s('compound binding dom bind','compound binding',{fixture:'compound-binding-dom-bind'}),s(lang2+' compound binding dom bind','compound binding dom bind',{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s(lang2+' default observeHtmlLang simple text dom bind','simple text',{fixture:'simple-text-dom-bind',fixtureModel:{'html.lang':lang5},assign:{'html.lang':lang2},lang:lang2,effectiveLang:lang2,text:text_simple,model:undefined,localDOM:localDOM_simple,observeHtmlLang:true}),s('simple text dom bind','simple text',{fixture:'simple-text-dom-bind',fixtureModel:{observeHtmlLang:false,lang:lang0},text:text_simple,localDOM:localDOM_simple}),s(lang2+' simple text dom bind','simple text dom bind',{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s('html.lang simple text dom bind','simple text dom bind',{fixtureModel:{observeHtmlLang:true,lang:lang0,'html.lang':lang0},assign:{'html.lang':lang1},observeHtmlLang:true}),s(lang2+' html.lang simple text dom bind','html.lang simple text dom bind',{assign:{'html.lang':lang2},lang:lang2,effectiveLang:lang2}),s('observeHtmlLang default simple text','simple text null lang',{fixtureModel:{observeHtmlLang:true},assign:{'html.lang':lang1},lang:lang1,effectiveLang:lang1,observeHtmlLang:true})];window.dispatchEvent(new CustomEvent('suites-loaded'));suitesRunner(suites,100);});export{arraySelector as $arraySelector,customStyle as $customStyle,domBind as $domBind,domIf as $domIf,domModule as $domModule,domRepeat as $domRepeat,_class as $class,legacyElementMixin as $legacyElementMixin,mutableDataBehavior as $mutableDataBehavior,polymerFn as $polymerFn,polymer_dom as $polymerDom,templatizerBehavior as $templatizerBehavior,dirMixin as $dirMixin,elementMixin as $elementMixin,gestureEventListeners as $gestureEventListeners,mutableData as $mutableData,propertiesChanged as $propertiesChanged,propertiesMixin as $propertiesMixin,propertyAccessors as $propertyAccessors,propertyEffects as $propertyEffects,templateStamp as $templateStamp,arraySplice as $arraySplice,async as $async,caseMap$1 as $caseMap,debounce as $debounce,flattenedNodesObserver as $flattenedNodesObserver,flush$2 as $flush,gestures$1 as $gestures,htmlTag as $htmlTag,mixin as $mixin,path as $path,renderStatus as $renderStatus,resolveUrl$1 as $resolveUrl,settings as $settings,styleGather as $styleGather,templatize$1 as $templatize,polymerElement as $polymerElement,polymerLegacy as $polymerLegacy,applyShimUtils as $applyShimUtils,applyShim as $applyShim$1,commonRegex as $commonRegex,commonUtils as $commonUtils,cssParse as $cssParse,customStyleInterface as $customStyleInterface$1,documentWait$1 as $documentWait,styleSettings as $styleSettings,styleUtil as $styleUtil,templateMap$1 as $templateMap,unscopedStyleHandler as $unscopedStyleHandler,deepcopy$1 as $deepcopy,plurals$1 as $plurals,ArraySelectorMixin,ArraySelector,CustomStyle,DomBind,DomIf,DomModule,DomRepeat,mixinBehaviors,Class,LegacyElementMixin,MutableDataBehavior,OptionalMutableDataBehavior,Polymer$1 as Polymer,flush$1 as flush,enqueueDebouncer as addDebouncer,matchesSelector,DomApi,EventApi,dom,Templatizer,DirMixin,version,ElementMixin,instanceCount,registrations,register,dumpRegistrations,updateStyles,GestureEventListeners,MutableData,OptionalMutableData,PropertiesChanged,PropertiesMixin,PropertyAccessors,PropertyEffects,TemplateStamp,calculateSplices,timeOut,animationFrame,idlePeriod,microTask,dashToCamelCase,camelToDashCase,Debouncer,FlattenedNodesObserver,enqueueDebouncer,flush$1,gestures,recognizers,deepTargetFind,addListener,removeListener,register$1,setTouchAction,prevent,resetMouseCanceller,findOriginalTarget,add,remove,html,htmlLiteral,dedupingMixin,isPath,root,isAncestor,isDescendant,translate$1 as translate,matches,normalize,split,get,set,isDeep,flush as flush$2,beforeNextRender,afterNextRender,resolveUrl,resolveCss,pathFromUrl,useShadow,useNativeCSSProperties,useNativeCustomElements,rootPath,setRootPath,sanitizeDOMValue,setSanitizeDOMValue,passiveTouchGestures,setPassiveTouchGestures,strictTemplatePolicy,setStrictTemplatePolicy,allowTemplateFromDomModule,setAllowTemplateFromDomModule,stylesFromModules,stylesFromModule,stylesFromTemplate,stylesFromModuleImports,cssFromModules,cssFromModule,cssFromTemplate,cssFromModuleImports,templatize,modelForElement,TemplateInstanceBase,html as html$1,version as version$1,PolymerElement,Polymer$1,html as html$2,Base,invalidate,invalidateTemplate,isValid,templateIsValid,isValidating,templateIsValidating,startValidating,startValidatingTemplate,elementsAreInvalid,ApplyShim as $applyShimDefault,VAR_ASSIGN,MIXIN_MATCH,VAR_CONSUMED,ANIMATION_MATCH,MEDIA_MATCH,IS_VAR,BRACKETED,HOST_PREFIX,HOST_SUFFIX,updateNativeProperties,getComputedStyleValue,detectMixin,StyleNode,parse,stringify,removeCustomPropAssignment,types,CustomStyleProvider,CustomStyleInterface as $customStyleInterfaceDefault,CustomStyleInterfaceInterface,documentWait as $documentWaitDefault,nativeShadow,cssBuild,nativeCssVariables,toCssText,rulesForStyle,isKeyframesSelector,forEachRule,applyCss,createScopeStyle,applyStylePlaceHolder,applyStyle,isTargetedBuild,findMatchingParen,processVariableAndFallback,setElementClassRaw,wrap,getIsExtends,gatherStyleText,splitSelectorList,getCssBuild,elementHasBuiltCss,getBuildComment,isOptimalCssBuild,templateMap as $templateMapDefault,scopingAttribute,processUnscopedStyle,isUnscopedStyle,deepcopy as $deepcopyDefault,plurals as $pluralsDefault}; \ No newline at end of file diff --git a/test/bundled/basic-test-suites.js b/test/bundled/basic-test-suites.js new file mode 100644 index 00000000..2140e2ad --- /dev/null +++ b/test/bundled/basic-test-suites.js @@ -0,0 +1,1299 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import './test-runner.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +let intervalId = setInterval(function () { +var bind = document.querySelector('#simple-attribute-dom-bind'); +if (bind) { + clearInterval(intervalId); +} +else { + return; +} + +bind.addEventListener('dom-change', function onDomChangeForBind (event) { + if (!bind.done && event.target === bind) { + bind._langUpdated = function (e) { + if (e.composedPath()[0] === this) { + console.log('bind._langUpdated: ' + this.is + ' ' + this.id + ' ' + e.type + ' ' + this.lang + ' params.lang = ' + (this.params ? this.params.lang : '')); + console.log('bind._langUpdated: deepcopying model for lang ' + this.lang); + this.model = deepcopy(this.text.model); + this.notifyPath('model', this.model); + this.render(); + } + }.bind(bind); + + bind._onDomChangeAfterLangUpdated = function (e) { + console.log('bind._onDomChangeAfterLangUpdated ' + this.is + ' ' + this.id + ' ' + e.type + ' ' + this.lang + ' params.lang = ' + (this.params ? this.params.lang : '')); + if (this.params && this.params.lang === this.lang) { + console.log('bind._onDomChangeAfterLangUpdated ' + this.is + ' ' + this.id + ' ' + e.type + ' firing local-dom-ready'); + this.fire('local-dom-ready'); + } + e.stopPropagation(); + return false; + }.bind(bind); + + bind.addEventListener('lang-updated', bind._langUpdated); + bind.addEventListener('dom-change', bind._onDomChangeAfterLangUpdated); + + window.removeEventListener('dom-change', onDomChangeForBind); + bind.done = true; + } +}); +}, 10); + +suite('I18nElement with ' + + (window.location.href.indexOf('?dom=Shadow') >= 0 ? 'Shadow DOM' : 'Shady DOM') + + (' in ' + syntax + ' syntax'), + function () { + + var lang0 = ''; + var lang1 = 'en'; + var lang2 = 'fr'; + var lang3 = 'ja'; + var lang4 = 'fr-CA'; + var lang5 = 'zh-Hans-CN'; + var lang6 = 'ru'; + var text_simple = { + 'model': {}, + 'text': ' outermost text at the beginning ', + 'h1_3': 'outermost header 1', + 'text_4': ' outermost text in the middle ', + 'span_5': 'simple text without id', + 'span_6': 'simple text without id 2', + 'label-1': 'simple text with id', + 'label-2': 'simple text with id 2', + 'div_9:span': 'simple text within div', + 'div_9:span_1': 'simple text within div 2', + 'div_9:div_2:div': 'great grandchild text within div', + 'div_10:text': ' simple text as the first element in div ', + 'div_10:span_1': 'simple text within div', + 'div_10:text_2': ' simple text in the middle of div ', + 'div_10:span_3': 'simple text within div 2', + 'div_10:div_4:div': 'great grandchild text within div', + 'div_10:text_5': ' simple text at the last element in div ', + 'toplevel-div:span': 'simple text within div', + 'toplevel-div:span_1': 'simple text within div 2', + 'third-level-div': 'great grandchild text within div', + 'second-level-div:div_1': 'great grandchild text within div without id', + 'div_12:ul:li': 'line item without id 1', + 'div_12:ul:li_1': 'line item without id 2', + 'div_12:ul:li_2': 'line item without id 3', + 'line-items:li': 'line item with id 1', + 'line-items:li_1': 'line item with id 2', + 'line-items:li_2': 'line item with id 3', + 'p_13': [ + 'A paragraph with {1} is converted to {2}.', + 'parameters', + '' + ], + 'paragraph': [ + 'A paragraph with {1} is converted to {2}.', + 'id', + '' + ], + 'text_15': ' outermost text at the end ' + }; + var localDOM_simple = [ + { select: 'div:not([id])', 'previousTextSibling.data': ' outermost text at the beginning ' }, + { select: 'h1', textContent: 'outermost header 1' }, + { select: 'h1', 'nextTextSibling.data': ' outermost text in the middle ' }, + { select: 'span:not([id])', textContent: [ 'simple text without id', 'simple text without id 2' ] }, + { select: 'span[id="label-1"]', textContent: 'simple text with id' }, + { select: 'span[id="label-2"]', textContent: 'simple text with id 2' }, + { select: 'span[id="label-2"] + div span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[id="label-2"] + div div:not([id]) div:not([id])', textContent: [ 'great grandchild text within div' ] }, + { select: 'span[id="label-2"] + div + div', 'childNodes.0.data': ' simple text as the first element in div ' }, + { select: 'span[id="label-2"] + div + div span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[id="label-2"] + div + div span:not([id])', 'nextTextSibling.data': ' simple text in the middle of div ' }, + { select: 'span[id="label-2"] + div + div div:not([id]) div:not([id])', textContent: 'great grandchild text within div' }, + { select: 'span[id="label-2"] + div + div div:not([id])', 'nextTextSibling.data': ' simple text at the last element in div ' }, + { select: '[id="toplevel-div"] span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: '[id="third-level-div"]', textContent: 'great grandchild text within div' }, + { select: '[id="second-level-div"] div:not([id])', textContent: 'great grandchild text within div without id' }, + { select: 'div ul:not([id]) li:not([id])', textContent: [ 'line item without id 1', 'line item without id 2', 'line item without id 3' ] }, + { select: '[id="line-items"] li:not([id])', textContent: [ 'line item with id 1', 'line item with id 2', 'line item with id 3' ] }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.0.textContent': 'A paragraph with {1} is converted to {2}.' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'parameters', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': '', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.0.textContent': 'A paragraph with {1} is converted to {2}.' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'id', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': '', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"]', 'nextTextSibling.data': ' outermost text at the end ' } + ]; + var text_simple_text_id = { + 'model': {}, + 'text': ' outermost text at the beginning ', + 'h1_3': 'outermost header 1', + 'text_4': ' outermost text in the middle ', + 'span_5': 'simple text without id', + 'span_6': 'simple text without id 2', + 'label-1': 'simple text with id', + 'label-2': 'simple text with id 2', + 'div_9:span': 'simple text within div', + 'div_9:span_1': 'simple text within div 2', + 'div_9:div_2:div': 'great grandchild text within div', + 'div_10:text': ' simple text as the first element in div ', + 'div_10:span_1': 'simple text within div', + 'div_10:text_2': ' simple text in the middle of div ', + 'div_10:span_3': 'simple text within div 2', + 'div_10:div_4:div': 'great grandchild text within div', + 'div_10:text_5': ' simple text at the last element in div ', + 'toplevel-div:span': 'simple text within div', + 'toplevel-div:span_1': 'simple text within div 2', + 'second-level-div': [ + ' {1}\n {2} ', + 'great grandchild text within div', + 'great grandchild text within div without id' + ], + 'div_12:ul:li': 'line item without id 1', + 'div_12:ul:li_1': 'line item without id 2', + 'div_12:ul:li_2': 'line item without id 3', + 'line-items': [ + ' {1}\n {2}\n {3} ', + 'line item with id 1', + 'line item with id 2', + 'line item with id 3' + ], + 'p_13': [ + 'A paragraph with {1} is converted to {2}.', + 'parameters', + '' + ], + 'paragraph': [ + 'A paragraph with {1} is converted to {2}.', + 'id', + '' + ], + 'text_15': ' outermost text at the end ' + }; + var localDOM_simple_text_id = [ + { select: 'div:not([text-id])', 'previousTextSibling.data': ' outermost text at the beginning ' }, + { select: 'h1', textContent: 'outermost header 1' }, + { select: 'h1', 'nextTextSibling.data': ' outermost text in the middle ' }, + { select: 'span:not([text-id])', textContent: [ 'simple text without id', 'simple text without id 2' ] }, + { select: 'span[text-id="label-1"]', textContent: 'simple text with id' }, + { select: 'span[text-id="label-2"]', textContent: 'simple text with id 2' }, + { select: 'span[text-id="label-2"] + div span:not([text-id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[text-id="label-2"] + div div:not([text-id]) div:not([text-id])', textContent: [ 'great grandchild text within div' ] }, + { select: 'span[text-id="label-2"] + div + div', 'childNodes.0.data': ' simple text as the first element in div ' }, + { select: 'span[text-id="label-2"] + div + div span:not([text-id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[text-id="label-2"] + div + div span:not([text-id])', 'nextTextSibling.data': ' simple text in the middle of div ' }, + { select: 'span[text-id="label-2"] + div + div div:not([text-id]) div:not([text-id])', textContent: 'great grandchild text within div' }, + { select: 'span[text-id="label-2"] + div + div div:not([text-id])', 'nextTextSibling.data': ' simple text at the last element in div ' }, + { select: '[text-id="toplevel-div"] span:not([text-id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: '[text-id="second-level-div"] i18n-format', + 'PolymerDom.children.0.textContent': ' {1}\n {2} ' }, + { select: '[text-id="second-level-div"] i18n-format', + 'PolymerDom.children.1.tagName': 'DIV', + 'PolymerDom.children.1.textContent': 'great grandchild text within div', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: '[text-id="second-level-div"] i18n-format', + 'PolymerDom.children.2.tagName': 'DIV', + 'PolymerDom.children.2.textContent': 'great grandchild text within div without id', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: 'div ul:not([text-id]) li:not([text-id])', textContent: [ 'line item without id 1', 'line item without id 2', 'line item without id 3' ] }, + { select: '[text-id="line-items"] i18n-format', + 'PolymerDom.children.0.textContent': ' {1}\n {2}\n {3} ' }, + { select: '[text-id="line-items"] i18n-format', + 'PolymerDom.children.1.tagName': 'LI', + 'PolymerDom.children.1.textContent': 'line item with id 1', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: '[text-id="line-items"] i18n-format', + 'PolymerDom.children.2.tagName': 'LI', + 'PolymerDom.children.2.textContent': 'line item with id 2', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[text-id="line-items"] i18n-format', + 'PolymerDom.children.3.tagName': 'LI', + 'PolymerDom.children.3.textContent': 'line item with id 3', + 'PolymerDom.children.3.attributes.slot.value': '3' }, + { select: 'p:not([text-id]) i18n-format', + 'PolymerDom.children.0.textContent': 'A paragraph with {1} is converted to {2}.' }, + { select: 'p:not([text-id]) i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'parameters', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: 'p:not([text-id]) i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': '', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[text-id="paragraph"] i18n-format', + 'PolymerDom.children.0.textContent': 'A paragraph with {1} is converted to {2}.' }, + { select: '[text-id="paragraph"] i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'id', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: '[text-id="paragraph"] i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': '', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[text-id="paragraph"]', 'nextTextSibling.data': ' outermost text at the end ' } + ]; + var sender1 = { + 'name': 'Joe', + 'gender': 'male' + }; + var recipients1 = [ + { 'name': 'Alice', 'gender': 'female' }, + { 'name': 'Bob', 'gender': 'male' }, + { 'name': 'Yoda', 'gender': 'other' } + ]; + var recipients2 = [ + { 'name': 'Alice', 'gender': 'female' }, + { 'name': 'Bob', 'gender': 'male' } + ]; + var recipients3 = [ + { 'name': 'Bob', 'gender': 'male' } + ]; + var recipients4 = []; + var text_plural_gender = { + 'model': {}, + 'compound-format-text': [ + { + '0': 'You ({3}) gave no gifts.', + '1': { + 'male': 'You ({3}) gave him ({4}) {5}.', + 'female': 'You ({3}) gave her ({4}) {5}.', + 'other': 'You ({3}) gave them ({4}) {5}.' + }, + 'one': { + 'male': 'You ({3}) gave him ({4}) and one other person {5}.', + 'female': 'You ({3}) gave her ({4}) and one other person {5}.', + 'other': 'You ({3}) gave them ({4}) and one other person {5}.' + }, + 'other': 'You ({3}) gave them ({4}) and {1} other people gifts.' + }, + '{{recipients.length - 1}}', + '{{recipients.0.gender}}', + '{{sender.name}}', + '{{recipients.0.name}}', + 'a gift' + ] + }; + var localDOM_plural_gender_1 = [ + { select: '#compound-format-text', 'root.PolymerDom.textContent': 'You () gave them () and other people gifts.' }, + { select: '#compound-format-text', 'PolymerDom.children.1.PolymerDom.childNodes.0.data.raw': '3' }, + { select: '#compound-format-text', 'PolymerDom.children.2.PolymerDom.childNodes.0.data.raw': 'female' }, + { select: '#compound-format-text', 'PolymerDom.children.3.PolymerDom.childNodes.0.data.raw': 'Joe' }, + { select: '#compound-format-text', 'PolymerDom.children.4.PolymerDom.childNodes.0.data.raw': 'Alice' }, + { select: '#compound-format-text', 'PolymerDom.children.5.PolymerDom.childNodes.0.data': 'a gift' } + ]; + var localDOM_plural_gender_2 = [ + { select: '#compound-format-text', 'root.PolymerDom.textContent': 'You () gave her () and one other person .' }, + { select: '#compound-format-text', 'PolymerDom.children.1.PolymerDom.childNodes.0.data.raw': '2' }, + { select: '#compound-format-text', 'PolymerDom.children.2.PolymerDom.childNodes.0.data.raw': 'female' }, + { select: '#compound-format-text', 'PolymerDom.children.3.PolymerDom.childNodes.0.data.raw': 'Joe' }, + { select: '#compound-format-text', 'PolymerDom.children.4.PolymerDom.childNodes.0.data.raw': 'Alice' }, + { select: '#compound-format-text', 'PolymerDom.children.5.PolymerDom.childNodes.0.data': 'a gift' } + ]; + var localDOM_plural_gender_3 = [ + { select: '#compound-format-text', 'root.PolymerDom.textContent': 'You () gave him () .' }, + { select: '#compound-format-text', 'PolymerDom.children.1.PolymerDom.childNodes.0.data.raw': '1' }, + { select: '#compound-format-text', 'PolymerDom.children.2.PolymerDom.childNodes.0.data.raw': 'male' }, + { select: '#compound-format-text', 'PolymerDom.children.3.PolymerDom.childNodes.0.data.raw': 'Joe' }, + { select: '#compound-format-text', 'PolymerDom.children.4.PolymerDom.childNodes.0.data.raw': 'Bob' }, + { select: '#compound-format-text', 'PolymerDom.children.5.PolymerDom.childNodes.0.data': 'a gift' } + ]; + var localDOM_plural_gender_4 = [ + { select: '#compound-format-text', 'root.PolymerDom.textContent': 'You () gave no gifts.' }, + { select: '#compound-format-text', 'PolymerDom.children.1.PolymerDom.childNodes.0.data.raw': '0' }, + { select: '#compound-format-text', 'PolymerDom.children.2.PolymerDom.childNodes.0.data.raw': '' }, + { select: '#compound-format-text', 'PolymerDom.children.3.PolymerDom.childNodes.0.data.raw': 'Joe' }, + { select: '#compound-format-text', 'PolymerDom.children.4.PolymerDom.childNodes.0.data.raw': '' }, + { select: '#compound-format-text', 'PolymerDom.children.5.PolymerDom.childNodes.0.data': 'a gift' } + ]; + var text_simple_attribute = { + 'model': { + 'standard-input': { + 'placeholder': 'standard HTML5 attribute' + }, + 'outer-div:input_2': { + 'placeholder': 'standard HTML5 attribute without id' + }, + 'paper-input-element': { + 'label': 'paper-input label', + 'error-message': 'paper-input error message', + 'placeholder': 'paper-input placeholder' + }, + 'outer-div:paper-input_4': { + 'label': 'paper-input label without id', + 'error-message': 'paper-input error message without id', + 'placeholder': 'paper-input placeholder without id' + }, + 'pie-chart': { + 'options': { + 'title': 'Distribution of days in 2001H1' + }, + 'cols': [ + { + 'label': 'Month', + 'type': 'string' + }, + { + 'label': 'Days', + 'type': 'number' + } + ], + 'rows': [ + [ + 'Jan', + 31 + ], + [ + 'Feb', + 28 + ], + [ + 'Mar', + 31 + ], + [ + 'Apr', + 30 + ], + [ + 'May', + 31 + ], + [ + 'Jun', + 30 + ] + ] + }, + 'column-chart': { + 'options': { + 'title': 'Inventory' + }, + 'data': [ + [ + 'Year', + 'Things', + 'Stuff' + ], + [ + '2004', + 1000, + 400 + ], + [ + '2005', + 1170, + 460 + ], + [ + '2006', + 660, + 1120 + ], + [ + '2007', + 1030, + 540 + ] + ] + }, + 'custom-attr': { + 'custom-text-attr1': 'custom text attribute 1', + 'custom-text-attr2': 'custom text attribute 2', + 'custom-text-attr3': 'custom text attribute 3' + }, + 'selective-attr': { + 'custom-text-attr4': [ + '{1} custom-text-attr4 attribute with param {2} and param {3} {4}', + '{{text.ordinary-div}}', + '{{text.ordinary-div}}', + '[[text.ordinary-div]]', + '{{text.ordinary-div}}' + ], + 'custom-text-attr5': [ + '[[text.ordinary-div]]', + ' custom-text-attr5 attribute with param ', + "{{or('',text.ordinary-div)}}", + ' and param ', + '[[text.ordinary-div]]' + ], + 'i18n-target': [ + 'i18n-target attribute with param {1} and param {2}', + '{{text.ordinary-div}}', + '[[text.ordinary-div]]' + ], + 'i18n-target2': [ + 'i18n-target2 attribute with param ', + "{{or('',text.ordinary-div)}}", + ' and param ', + '[[text.ordinary-div]]' + ] + }, + 'selective-attr2': { + 'i18n-target': 'i18n-target attribute 2' + }, + 'selective-attr3': { + 'i18n-target6': 'i18n-target6 attribute 2' + }, + 'selective-attr4': { + 'i18n-target6': 'i18n-target6 attribute 3' + }, + 'json-data-id': { + 'attr1': 'this attr1 is extracted', + 'i18n-target-attr': 'this attribute is also extracted' + }, + 'template_2:json-data_1': { + 'attr1': 'this attr1 without id is extracted', + 'i18n-target-attr': 'this attribute without id is also extracted' + } + }, + 'ordinary-div': 'text 1' + }; + var model_simple_attribute = { + 'standard-input': { + 'placeholder': 'standard HTML5 attribute' + }, + 'outer-div:input_2': { + 'placeholder': 'standard HTML5 attribute without id' + }, + 'paper-input-element': { + 'label': 'paper-input label', + 'error-message': 'paper-input error message', + 'placeholder': 'paper-input placeholder' + }, + 'outer-div:paper-input_4': { + 'label': 'paper-input label without id', + 'error-message': 'paper-input error message without id', + 'placeholder': 'paper-input placeholder without id' + }, + 'pie-chart': { + 'options': { + 'title': 'Distribution of days in 2001H1' + }, + 'cols': [ + { + 'label': 'Month', + 'type': 'string' + }, + { + 'label': 'Days', + 'type': 'number' + } + ], + 'rows': [ + [ + 'Jan', + 31 + ], + [ + 'Feb', + 28 + ], + [ + 'Mar', + 31 + ], + [ + 'Apr', + 30 + ], + [ + 'May', + 31 + ], + [ + 'Jun', + 30 + ] + ] + }, + 'column-chart': { + 'options': { + 'title': 'Inventory' + }, + 'data': [ + [ + 'Year', + 'Things', + 'Stuff' + ], + [ + '2004', + 1000, + 400 + ], + [ + '2005', + 1170, + 460 + ], + [ + '2006', + 660, + 1120 + ], + [ + '2007', + 1030, + 540 + ] + ] + }, + 'custom-attr': { + 'custom-text-attr1': 'custom text attribute 1', + 'custom-text-attr2': 'custom text attribute 2', + 'custom-text-attr3': 'custom text attribute 3' + }, + 'selective-attr': { + 'custom-text-attr4': [ + '{1} custom-text-attr4 attribute with param {2} and param {3} {4}', + '{{text.ordinary-div}}', + '{{text.ordinary-div}}', + '[[text.ordinary-div]]', + '{{text.ordinary-div}}' + ], + 'custom-text-attr5': [ + '[[text.ordinary-div]]', + ' custom-text-attr5 attribute with param ', + "{{or('',text.ordinary-div)}}", + ' and param ', + '[[text.ordinary-div]]' + ], + 'i18n-target': [ + 'i18n-target attribute with param {1} and param {2}', + '{{text.ordinary-div}}', + '[[text.ordinary-div]]' + ], + 'i18n-target2': [ + 'i18n-target2 attribute with param ', + "{{or('',text.ordinary-div)}}", + ' and param ', + '[[text.ordinary-div]]' + ] + }, + 'selective-attr2': { + 'i18n-target': 'i18n-target attribute 2' + }, + 'selective-attr3': { + 'i18n-target6': 'i18n-target6 attribute 2' + }, + 'selective-attr4': { + 'i18n-target6': 'i18n-target6 attribute 3' + }, + 'json-data-id': { + 'attr1': 'this attr1 is extracted', + 'i18n-target-attr': 'this attribute is also extracted' + }, + 'template_2:json-data_1': { + 'attr1': 'this attr1 without id is extracted', + 'i18n-target-attr': 'this attribute without id is also extracted' + } + }; + var localDOM_simple_attribute = [ + { select: 'input[id="standard-input"]', 'placeholder.text': 'standard HTML5 attribute' }, + { select: 'input[id="standard-input"] + input', 'placeholder.text': 'standard HTML5 attribute without id' }, + { select: 'paper-input[id="paper-input-element"]', 'label.text': 'paper-input label', 'errorMessage.text': 'paper-input error message', 'placeholder.text': 'paper-input placeholder' }, + { select: 'paper-input[id="paper-input-element"] + paper-input', 'label.text': 'paper-input label without id', 'errorMessage.text': 'paper-input error message without id', 'placeholder.text': 'paper-input placeholder without id' }, + { select: 'google-chart[id="pie-chart"]', 'options.title.text': 'Distribution of days in 2001H1', 'cols.0.label.text': 'Month', 'cols.1.label.text': 'Days', 'rows.0.0.text': 'Jan', 'rows.1.0.text': 'Feb', 'rows.2.0.text': 'Mar', 'rows.3.0.text': 'Apr', 'rows.4.0.text': 'May', 'rows.5.0.text': 'Jun' }, + { select: 'google-chart[id="column-chart"]', 'options.title.text': 'Inventory', 'data.0.0.text': 'Year', 'data.0.1.text': 'Things', 'data.0.2.text': 'Stuff' }, + { select: 'text-attribute-element[id="custom-attr"]', 'customTextAttr1.text': 'custom text attribute 1', 'customTextAttr2.text': 'custom text attribute 2', 'customTextAttr3.text': 'custom text attribute 3' }, + { select: 'text-attribute-element[id="selective-attr"]', 'i18nTarget.raw': 'i18n-target attribute with param text 1 and param text 1', 'i18nTarget2.raw': 'i18n-target2 attribute with param text 1 and param text 1' }, + { select: 'span[id="test-json-data-1"]', 'textContent': 'this attr1 is extracted' }, + { select: 'span[id="test-json-data-2"]', 'textContent': 'this attribute is also extracted' }, + { select: 'span[id="test-json-data-3"]', 'textContent': 'this attr1 without id is extracted' }, + { select: 'span[id="test-json-data-4"]', 'textContent': 'this attribute without id is also extracted' }, + ]; + var localDOM_simple_attribute_fr = [ + { select: 'input[id="standard-input"]', 'placeholder.text': 'standard HTML5 attribute' }, + { select: 'input[id="standard-input"] + input', 'placeholder.text': 'standard HTML5 attribute without id' }, + { select: 'paper-input[id="paper-input-element"]', 'label.text': 'paper-input label', 'errorMessage.text': 'paper-input error message', 'placeholder.text': 'paper-input placeholder' }, + { select: 'paper-input[id="paper-input-element"] + paper-input', 'label.text': 'paper-input label without id', 'errorMessage.text': 'paper-input error message without id', 'placeholder.text': 'paper-input placeholder without id' }, + { select: 'google-chart[id="pie-chart"]', 'options.title.text': 'Distribution of days in 2001H1', 'cols.0.label.text': 'Month', 'cols.1.label.text': 'Days', 'rows.0.0.text': 'Jan', 'rows.1.0.text': 'Feb', 'rows.2.0.text': 'Mar', 'rows.3.0.text': 'Apr', 'rows.4.0.text': 'May', 'rows.5.0.text': 'Jun' }, + { select: 'google-chart[id="column-chart"]', 'options.title.text': 'Inventory', 'data.0.0.text': 'Year', 'data.0.1.text': 'Things', 'data.0.2.text': 'Stuff' }, + { select: 'text-attribute-element[id="custom-attr"]', 'customTextAttr1.text': 'custom text attribute 1', 'customTextAttr2.text': 'custom text attribute 2', 'customTextAttr3.text': 'custom text attribute 3' }, + { select: 'text-attribute-element[id="selective-attr"]', 'i18nTarget.raw': 'fr i18n-target attribute with param fr text 1 and param fr text 1', 'i18nTarget2.raw': 'fr i18n-target2 attribute with param fr text 1 fr and param fr text 1' }, + { select: 'span[id="test-json-data-1"]', 'textContent': 'this attr1 is extracted' }, + { select: 'span[id="test-json-data-2"]', 'textContent': 'this attribute is also extracted' }, + { select: 'span[id="test-json-data-3"]', 'textContent': 'this attr1 without id is extracted' }, + { select: 'span[id="test-json-data-4"]', 'textContent': 'this attribute without id is also extracted' }, + ]; + var text_fallback = { + 'model': {}, + 'text': 'fr-CA outermost text at the beginning ', + 'h1_3': 'fr-CA outermost header 1', + 'text_4': 'fr-CA outermost text in the middle ', + 'span_5': 'fr-CA simple text without id', + 'span_6': 'fr-CA simple text without id 2', + 'label-1': 'fr-CA simple text with id', + 'label-2': 'fr-CA simple text with id 2', + 'div_9:span': 'simple text within div', + 'div_9:span_1': 'simple text within div 2', + 'div_9:div_2:div': 'great grandchild text within div', + 'div_10:text': ' simple text as the first element in div ', + 'div_10:span_1': 'fr-CA simple text within div', + 'div_10:text_2': ' simple text in the middle of div ', + 'div_10:span_3': 'simple text within div 2', + 'div_10:div_4:div': 'great grandchild text within div', + 'div_10:text_5': ' simple text at the last element in div ', + 'toplevel-div:span': 'fr-CA simple text within div', + 'toplevel-div:span_1': 'fr-CA simple text within div 2', + 'third-level-div': 'fr-CA great grandchild text within div', + 'second-level-div:div_1': 'fr-CA great grandchild text within div without id', + 'div_12:ul:li': 'fr line item without id 1', + 'div_12:ul:li_1': 'fr line item without id 2', + 'div_12:ul:li_2': 'fr line item without id 3', + 'line-items:li': 'fr line item with id 1', + 'line-items:li_1': 'fr line item with id 2', + 'line-items:li_2': 'fr line item with id 3', + 'p_13': [ + 'fr-CA A paragraph with {1} is converted to {2}.', + 'fr-CA parameters', + 'fr-CA ' + ], + 'paragraph': [ + 'fr-CA A paragraph with {1} is converted to {2}.', + 'fr-CA id', + 'fr-CA ' + ], + 'text_15': 'fr-CA outermost text at the end ' + }; + var localDOM_fallback = [ + { select: 'div:not([id])', 'previousTextSibling.data': 'fr-CA outermost text at the beginning ' }, + { select: 'h1', textContent: 'fr-CA outermost header 1' }, + { select: 'h1', 'nextTextSibling.data': 'fr-CA outermost text in the middle ' }, + { select: 'span:not([id])', textContent: [ 'fr-CA simple text without id', 'fr-CA simple text without id 2' ] }, + { select: 'span[id="label-1"]', textContent: 'fr-CA simple text with id' }, + { select: 'span[id="label-2"]', textContent: 'fr-CA simple text with id 2' }, + { select: 'span[id="label-2"] + div span:not([id])', textContent: [ 'simple text within div', 'simple text within div 2' ] }, + { select: 'span[id="label-2"] + div div:not([id]) div:not([id])', textContent: [ 'great grandchild text within div' ] }, + { select: 'span[id="label-2"] + div + div', 'childNodes.0.data': ' simple text as the first element in div ' }, + { select: 'span[id="label-2"] + div + div span:not([id])', textContent: [ 'fr-CA simple text within div', 'simple text within div 2' ] }, + { select: 'span[id="label-2"] + div + div span:not([id])', 'nextTextSibling.data': ' simple text in the middle of div ' }, + { select: 'span[id="label-2"] + div + div div:not([id]) div:not([id])', textContent: 'great grandchild text within div' }, + { select: 'span[id="label-2"] + div + div div:not([id])', 'nextTextSibling.data': ' simple text at the last element in div ' }, + { select: '[id="toplevel-div"] span:not([id])', textContent: [ 'fr-CA simple text within div', 'fr-CA simple text within div 2' ] }, + { select: '[id="third-level-div"]', textContent: 'fr-CA great grandchild text within div' }, + { select: '[id="second-level-div"] div:not([id])', textContent: 'fr-CA great grandchild text within div without id' }, + { select: 'div ul:not([id]) li:not([id])', textContent: [ 'fr line item without id 1', 'fr line item without id 2', 'fr line item without id 3' ] }, + { select: '[id="line-items"] li:not([id])', textContent: [ 'fr line item with id 1', 'fr line item with id 2', 'fr line item with id 3' ] }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.0.textContent': 'fr-CA A paragraph with {1} is converted to {2}.' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'fr-CA parameters', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: 'p:not([id]) i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': 'fr-CA ', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.0.textContent': 'fr-CA A paragraph with {1} is converted to {2}.' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'fr-CA id', + 'PolymerDom.children.1.attributes.slot.value': '1' }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.2.tagName': 'CODE', + 'PolymerDom.children.2.textContent': 'fr-CA ', + 'PolymerDom.children.2.attributes.slot.value': '2' }, + { select: '[id="paragraph"]', 'nextTextSibling.data': 'fr-CA outermost text at the end ' } + ]; + var param1 = '1st compound parameter'; + var param2 = '2nd compound parameter'; + var text_compound = { + 'model': {}, + 'text': [ + ' outermost text at the beginning with compound {1} and {2} variables ', + '{{param1}}', + '{{param2}}' + ], + 'h1_3': [ + 'outermost header 1 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'text_4': [ + ' outermost text in the middle with {1} and {2} variables ', + '{{param1}}', + '{{param2}}' + ], + 'span_5': [ + 'simple text without id with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'span_6': [ + 'simple text without id 2 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'label-1': [ + 'simple text with id and {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'label-2': [ + 'simple text with id and {1} and {2} variables 2', + '{{param1}}', + '{{param2}}' + ], + 'div_9:span': [ + 'simple text within div with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_9:span_1': [ + 'simple text within div with {1} and {2} variables 2', + '{{param1}}', + '{{param2}}' + ], + 'div_9:div_2:div': [ + 'great grandchild text within div with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_10:text': [ + ' simple text as the first element in div with {1} and {2} variables ', + '{{param1}}', + '{{param2}}' + ], + 'div_10:span_1': [ + 'simple text within div with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_10:text_2': [ + ' simple text in the middle of div with {1} and {2} variables ', + '{{param1}}', + '{{param2}}' + ], + 'div_10:span_3': [ + 'simple text within div with {1} and {2} variables 2', + '{{param1}}', + '{{param2}}' + ], + 'div_10:div_4:div': [ + 'great grandchild text within div with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_10:text_5': [ + ' simple text at the last element in div with {1} and {2} variables ', + '{{param1}}', + '{{param2}}' + ], + 'toplevel-div:span': [ + 'simple text within div with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'toplevel-div:span_1': [ + 'simple text within div 2 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'third-level-div': [ + 'great grandchild text within div with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'second-level-div:div_1': [ + 'great grandchild text within div without id with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_12:ul:li': [ + 'line item without id 1 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_12:ul:li_1': [ + 'line item without id 2 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'div_12:ul:li_2': [ + 'line item without id 3 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'line-items:li': [ + 'line item with id 1 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'line-items:li_1': [ + 'line item with id 2 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'line-items:li_2': [ + 'line item with id 3 with {1} and {2} variables', + '{{param1}}', + '{{param2}}' + ], + 'p_13': [ + 'A paragraph with {1} is converted to {2}.', + '{{param1}}', + '{{param2}}' + ], + 'paragraph': [ + 'A paragraph with {1}, {2}, and {3} is converted to {4}.', + 'id', + '{{param1}}', + '{{param2}}', + '' + ], + 'text_15': [ + ' outermost text at the end with {1} and {2} variables ', + '{{param1}}', + '{{param2}}' + ] + }; + var localDOM_compound = [ + { select: 'i18n-format', + 'PolymerDom.children.0.textContent': [ + ' outermost text at the beginning with compound {1} and {2} variables ', + 'outermost header 1 with {1} and {2} variables', + ' outermost text in the middle with {1} and {2} variables ', + 'simple text without id with {1} and {2} variables', + 'simple text without id 2 with {1} and {2} variables', + 'simple text with id and {1} and {2} variables', + 'simple text with id and {1} and {2} variables 2', + 'simple text within div with {1} and {2} variables', + 'simple text within div with {1} and {2} variables 2', + 'great grandchild text within div with {1} and {2} variables', + ' simple text as the first element in div with {1} and {2} variables ', + 'simple text within div with {1} and {2} variables', + ' simple text in the middle of div with {1} and {2} variables ', + 'simple text within div with {1} and {2} variables 2', + 'great grandchild text within div with {1} and {2} variables', + ' simple text at the last element in div with {1} and {2} variables ', + 'simple text within div with {1} and {2} variables', + 'simple text within div 2 with {1} and {2} variables', + 'great grandchild text within div with {1} and {2} variables', + 'great grandchild text within div without id with {1} and {2} variables', + 'line item without id 1 with {1} and {2} variables', + 'line item without id 2 with {1} and {2} variables', + 'line item without id 3 with {1} and {2} variables', + 'line item with id 1 with {1} and {2} variables', + 'line item with id 2 with {1} and {2} variables', + 'line item with id 3 with {1} and {2} variables', + 'A paragraph with {1} is converted to {2}.', + 'A paragraph with {1}, {2}, and {3} is converted to {4}.', + ' outermost text at the end with {1} and {2} variables ' + ], + 'PolymerDom.children.1.textContent.raw': [ + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter', + '1st compound parameter' + ], + 'PolymerDom.children.2.textContent.raw': [ + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '2nd compound parameter', + '1st compound parameter', + '2nd compound parameter' + ] + }, + { select: '[id="paragraph"] i18n-format', + 'PolymerDom.children.1.tagName': 'B', + 'PolymerDom.children.1.textContent': 'id', + 'PolymerDom.children.1.attributes.slot.value.raw': '1', + 'PolymerDom.children.3.tagName': 'SPAN', + 'PolymerDom.children.3.textContent.raw': '2nd compound parameter', + 'PolymerDom.children.3.attributes.slot.value.raw': '3' + }, + { select: '[id="paragraph"] +i18n-format', + 'PolymerDom.children.1.textContent.raw': '1st compound parameter' + } + ]; + + var suites = [ + s('simple text default', null, { + fixture: 'simple-text-element-default-fixture', + fixtureModel: undefined, + assign: undefined, + lang: lang1, + effectiveLang: lang1, + templateDefaultLang: lang1, + observeHtmlLang: true, + text: text_simple, + model: {}, + localDOM: localDOM_simple, + lightDOM: undefined + }), + s('commented simple text default', 'simple text default', { + fixture: 'commented-simple-text-element-default-fixture' + }), + s('simple text default null lang', 'simple text default', { + assign: { lang: lang0 }, + lang: lang0, + effectiveLang: lang0 + }), + s('commented simple text default null lang', 'commented simple text default', { + assign: { lang: lang0 }, + lang: lang0, + effectiveLang: lang0 + }), + s(lang2 + ' simple text default', 'simple text default', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang2 + ' commented simple text default', 'commented simple text default', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s('simple text null lang', 'simple text default', { + fixture: 'simple-text-element-fixture', + fixtureModel: { observeHtmlLang: false, lang: lang0 }, + assign: { lang: lang0 }, + lang: lang0, + effectiveLang: lang0, + observeHtmlLang: false + }), + s('simple text', 'simple text null lang', { + assign: { lang: lang1 }, + lang: lang1, + effectiveLang: lang1 + }), + s(lang2 + ' simple text', 'simple text', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang6 + ' simple text', 'simple text', { + assign: { lang: lang6 }, + lang: lang6, + effectiveLang: lang6 + }), + s('commented simple text', 'simple text', { + fixture: 'commented-simple-text-element-fixture' + }), + s('commented simple text null lang', 'commented simple text', { + assign: { lang: lang0 }, + lang: lang0, + effectiveLang: lang0 + }), + s(lang2 + ' commented simple text', 'commented simple text', { + fixtureModel: { observeHtmlLang: false, lang: lang0 }, + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang2 + ' static commented simple text', 'commented simple text', { + fixtureModel: { observeHtmlLang: false, lang: lang2 }, + assign: undefined, + lang: lang2, + effectiveLang: lang2 + }), + s('simple text id', 'simple text', { + fixture: 'simple-text-id-element-fixture', + text: text_simple_text_id, + localDOM: localDOM_simple_text_id + }), + s(lang2 + ' simple text id', 'simple text id', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s('plural gender', 'simple text default', { + fixture: 'plural-gender-element-fixture', + fixtureModel: { + observeHtmlLang: false, + lang: lang0 + }, + assign: { + lang: lang1, + sender: sender1, + recipients: recipients1 + }, + observeHtmlLang: false, + event: 'local-dom-ready', + text: text_plural_gender, + localDOM: localDOM_plural_gender_1 + }), + s('plural gender 2', 'plural gender', { + assign: { + lang: lang1, + sender: sender1, + recipients: recipients2 + }, + localDOM: localDOM_plural_gender_2 + }), + s('plural gender 3', 'plural gender', { + assign: { + lang: lang1, + sender: sender1, + recipients: recipients3 + }, + localDOM: localDOM_plural_gender_3 + }), + s('plural gender 4', 'plural gender', { + assign: { + lang: lang1, + sender: sender1, + recipients: recipients4 + }, + localDOM: localDOM_plural_gender_4 + }), + s(lang2 + ' plural gender', 'plural gender', { + assign: { + lang: lang2, + sender: sender1, + recipients: recipients1 + }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang2 + ' plural gender 2', 'plural gender 2', { + assign: { + lang: lang2, + sender: sender1, + recipients: recipients2 + }, + lang: lang2, + effectiveLang: lang2, + localDOM: localDOM_plural_gender_2 + }), + s(lang2 + ' plural gender 3', 'plural gender 3', { + assign: { + lang: lang2, + sender: sender1, + recipients: recipients3 + }, + lang: lang2, + effectiveLang: lang2, + localDOM: localDOM_plural_gender_3 + }), + s(lang2 + ' plural gender 4', 'plural gender 4', { + assign: { + lang: lang2, + sender: sender1, + recipients: recipients4 + }, + lang: lang2, + effectiveLang: lang2, + localDOM: localDOM_plural_gender_4 + }), + s('simple attribute', 'simple text default', { + fixture: 'simple-attribute-element-fixture', + fixtureModel: { + observeHtmlLang: false, + lang: lang0 + }, + assign: { lang: lang1 }, + observeHtmlLang: false, + text: text_simple_attribute, + model: model_simple_attribute, + localDOM: localDOM_simple_attribute + }), + s(lang2 + ' simple attribute', 'simple attribute', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2, + localDOM: localDOM_simple_attribute_fr + }), + s(lang4 + ' simple text default with fallback to ' + lang2, 'simple text default', { + timeout: 60000, + assign: { lang: lang4 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang4 + ' simple text with fallback to ' + lang2, 'simple text', { + timeout: 60000, + assign: { lang: lang4 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang5 + ' simple text with fallback to default', 'simple text', { + timeout: 60000, + assign: { lang: lang5 }, + lang: lang0, + effectiveLang: lang0 + }), + s(lang3 + ' simple text with fallback to default', 'simple text', { + timeout: 60000, + assign: { lang: lang3 }, + lang: lang0, + effectiveLang: lang0 + }), + s(lang4 + ' fallback text', 'simple text', { + timeout: 60000, + fixture: 'fallback-text-element-fixture', + assign: { lang: lang4 }, + lang: lang4, + effectiveLang: lang4, + rawText: true, + text: text_fallback, + localDOM: localDOM_fallback + }), + s('compound binding', 'simple text', { + fixture: 'compound-binding-element-fixture', + fixtureModel: { + observeHtmlLang: false, + lang: lang0, + param1: param1, + param2: param2 + }, + text: text_compound, + localDOM: localDOM_compound + }), + s(lang2 + ' compound binding', 'compound binding', { + fixtureModel: { + observeHtmlLang: false, + lang: lang0, + param1: param1, + param2: param2 + }, + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s('simple attribute dom bind', 'simple attribute', { + fixture: 'simple-attribute-dom-bind', + fixtureModel: { + observeHtmlLang: false, + lang: lang0 + }, + assign: { lang: lang1 }, + event: 'local-dom-ready', + text: text_simple_attribute, + model: model_simple_attribute, + localDOM: localDOM_simple_attribute + }), + s(lang2 + ' simple attribute dom bind', 'simple attribute dom bind', { + fixtureModel: { + observeHtmlLang: false, + lang: lang0 + }, + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2, + localDOM: localDOM_simple_attribute_fr + }), + s('compound binding dom bind', 'compound binding', { + fixture: 'compound-binding-dom-bind' + }), + s(lang2 + ' compound binding dom bind', 'compound binding dom bind', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s(lang2 + ' default observeHtmlLang simple text dom bind', 'simple text', { + fixture: 'simple-text-dom-bind', + fixtureModel: { + 'html.lang': lang5 + }, + assign: { 'html.lang': lang2 }, + lang: lang2, + effectiveLang: lang2, + text: text_simple, + model: undefined, + localDOM: localDOM_simple, + observeHtmlLang: true + }), + s('simple text dom bind', 'simple text', { + fixture: 'simple-text-dom-bind', + fixtureModel: { + observeHtmlLang: false, + lang: lang0 + }, + text: text_simple, + localDOM: localDOM_simple + }), + s(lang2 + ' simple text dom bind', 'simple text dom bind', { + assign: { lang: lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s('html.lang simple text dom bind', 'simple text dom bind', { + fixtureModel: { + observeHtmlLang: true, + lang: lang0, + 'html.lang': lang0 + }, + assign: { 'html.lang': lang1 }, + observeHtmlLang: true + }), + s(lang2 + ' html.lang simple text dom bind', 'html.lang simple text dom bind', { + assign: { 'html.lang': lang2 }, + lang: lang2, + effectiveLang: lang2 + }), + s('observeHtmlLang default simple text', 'simple text null lang', { + fixtureModel: { + observeHtmlLang: true + }, + assign: { 'html.lang': lang1 }, + lang: lang1, + effectiveLang: lang1, + observeHtmlLang: true + }) + ]; + + window.dispatchEvent(new CustomEvent('suites-loaded')); + suitesRunner(suites, 100); +}); diff --git a/test/bundled/basic-test.html b/test/bundled/basic-test.html new file mode 100644 index 00000000..bfaa59d2 --- /dev/null +++ b/test/bundled/basic-test.html @@ -0,0 +1,578 @@ + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/bundled/commented-simple-text-element/commented-simple-text-element.js b/test/bundled/commented-simple-text-element/commented-simple-text-element.js new file mode 100644 index 00000000..90ad29f4 --- /dev/null +++ b/test/bundled/commented-simple-text-element/commented-simple-text-element.js @@ -0,0 +1,435 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class CommentedSimpleTextElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +{{text.text}} +
+   +

{{text.h1_3}}

{{text.text_4}} + {{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+ +
{{text.div_10:text}} + {{text.div_10:span_1}}{{text.div_10:text_2}} + {{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} + +`); + } + + static get is() { return 'commented-simple-text-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(CommentedSimpleTextElement.is, CommentedSimpleTextElement); + } + break; +case 'base-element': + { + class CommentedSimpleTextElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +{{text.text}} +
+   +

{{text.h1_3}}

{{text.text_4}} + {{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+ +
{{text.div_10:text}} + {{text.div_10:span_1}}{{text.div_10:text_2}} + {{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} + +`); + } + + static get is() { return 'commented-simple-text-element' } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(CommentedSimpleTextElement.is, CommentedSimpleTextElement); + } + break; +case 'thin': + { + Define = class CommentedSimpleTextElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + }; + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html` +{{text.text}} +
+   +

{{text.h1_3}}

{{text.text_4}} + {{text.span_5}} + {{text.span_6}} + {{text.label-1}} + {{text.label-2}} +
+ {{text.div_9:span}} + {{text.div_9:span_1}} +
{{text.div_9:div_2:div}}
+
+ +
{{text.div_10:text}} + {{text.div_10:span_1}}{{text.div_10:text_2}} + {{text.div_10:span_3}} +
{{text.div_10:div_4:div}}
{{text.div_10:text_5}}
+
+ {{text.toplevel-div:span}} + {{text.toplevel-div:span_1}} +
+
{{text.third-level-div}}
+
{{text.second-level-div:div_1}}
+
+
+
+
    +
  • {{text.div_12:ul:li}}
  • +
  • {{text.div_12:ul:li_1}}
  • +
  • {{text.div_12:ul:li_2}}
  • +
+
    +
  • {{text.line-items:li}}
  • +
  • {{text.line-items:li_1}}
  • +
  • {{text.line-items:li_2}}
  • +
+
+

{{text.p_13.0}}{{text.p_13.1}}{{text.p_13.2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{text.paragraph.2}}

{{text.text_15}} + +`), + + is: 'commented-simple-text-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + listeners: { + 'lang-updated': '_langUpdated' + }, + + ready: function () { + //this.observeHtmlLang = false; + }, + + attached: function () { + }, + + _langUpdated: function (e) { + console.log(this.is, 'lang-updated', e.detail); + if (dom(e).rootTarget === this) { + this.model = deepcopy(this.text.model); + } + } + }); + } + break; +} diff --git a/test/bundled/commented-simple-text-element/commented-simple-text-element.json b/test/bundled/commented-simple-text-element/commented-simple-text-element.json new file mode 100644 index 00000000..f9b2ccf7 --- /dev/null +++ b/test/bundled/commented-simple-text-element/commented-simple-text-element.json @@ -0,0 +1,41 @@ +{ + "meta": {}, + "model": {}, + "text": " outermost text at the beginning ", + "h1_3": "outermost header 1", + "text_4": " outermost text in the middle ", + "span_5": "simple text without id", + "span_6": "simple text without id 2", + "label-1": "simple text with id", + "label-2": "simple text with id 2", + "div_9:span": "simple text within div", + "div_9:span_1": "simple text within div 2", + "div_9:div_2:div": "great grandchild text within div", + "div_10:text": " simple text as the first element in div ", + "div_10:span_1": "simple text within div", + "div_10:text_2": " simple text in the middle of div ", + "div_10:span_3": "simple text within div 2", + "div_10:div_4:div": "great grandchild text within div", + "div_10:text_5": " simple text at the last element in div ", + "toplevel-div:span": "simple text within div", + "toplevel-div:span_1": "simple text within div 2", + "third-level-div": "great grandchild text within div", + "second-level-div:div_1": "great grandchild text within div without id", + "div_12:ul:li": "line item without id 1", + "div_12:ul:li_1": "line item without id 2", + "div_12:ul:li_2": "line item without id 3", + "line-items:li": "line item with id 1", + "line-items:li_1": "line item with id 2", + "line-items:li_2": "line item with id 3", + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "parameters", + "" + ], + "paragraph": [ + "A paragraph with {1} is converted to {2}.", + "id", + "" + ], + "text_15": " outermost text at the end " +} \ No newline at end of file diff --git a/test/bundled/commented-simple-text-element/locales/commented-simple-text-element.fr.json b/test/bundled/commented-simple-text-element/locales/commented-simple-text-element.fr.json new file mode 100755 index 00000000..d993e702 --- /dev/null +++ b/test/bundled/commented-simple-text-element/locales/commented-simple-text-element.fr.json @@ -0,0 +1,43 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "text": " fr outermost text at the beginning ", + "h1_3": "fr outermost header 1", + "text_4": " fr outermost text in the middle ", + "span_5": "fr simple text without id", + "span_6": "fr simple text without id 2", + "label-1": "fr simple text with id", + "label-2": "fr simple text with id 2", + "div_9:span": "fr simple text within div", + "div_9:span_1": "fr simple text within div 2", + "div_9:div_2:div": "fr great grandchild text within div", + "div_10:text": " fr simple text as the first element in div ", + "div_10:span_1": "fr simple text within div", + "div_10:text_2": " fr simple text in the middle of div ", + "div_10:span_3": "fr simple text within div 2", + "div_10:div_4:div": "fr great grandchild text within div", + "div_10:text_5": " fr simple text at the last element in div ", + "toplevel-div:span": "fr simple text within div", + "toplevel-div:span_1": "fr simple text within div 2", + "third-level-div": "fr great grandchild text within div", + "second-level-div:div_1": "fr great grandchild text within div without id", + "div_12:ul:li": "fr line item without id 1", + "div_12:ul:li_1": "fr line item without id 2", + "div_12:ul:li_2": "fr line item without id 3", + "line-items:li": "fr line item with id 1", + "line-items:li_1": "fr line item with id 2", + "line-items:li_2": "fr line item with id 3", + "p_13": [ + "fr A paragraph with {1} is converted to {2}.", + "fr parameters", + "fr " + ], + "paragraph": [ + "fr A paragraph with {1} is converted to {2}.", + "fr id", + "fr " + ], + "text_15": " fr outermost text at the end " +} \ No newline at end of file diff --git a/test/bundled/compound-binding-dom-bind.json b/test/bundled/compound-binding-dom-bind.json new file mode 100644 index 00000000..87338aff --- /dev/null +++ b/test/bundled/compound-binding-dom-bind.json @@ -0,0 +1,151 @@ +{ + "meta": {}, + "model": {}, + "text": [ + " outermost text at the beginning with compound {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "h1_3": [ + "outermost header 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "text_4": [ + " outermost text in the middle with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "span_5": [ + "simple text without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "span_6": [ + "simple text without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-1": [ + "simple text with id and {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-2": [ + "simple text with id and {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:span": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_9:span_1": [ + "simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:div_2:div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text": [ + " simple text as the first element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_1": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_2": [ + " simple text in the middle of div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_3": [ + "simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_10:div_4:div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_5": [ + " simple text at the last element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span_1": [ + "simple text within div 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "third-level-div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "second-level-div:div_1": [ + "great grandchild text within div without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li": [ + "line item without id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_1": [ + "line item without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_2": [ + "line item without id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li": [ + "line item with id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_1": [ + "line item with id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_2": [ + "line item with id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "{{param1}}", + "{{param2}}" + ], + "paragraph": [ + "A paragraph with {1}, {2}, and {3} is converted to {4}.", + "id", + "{{param1}}", + "{{param2}}", + "" + ], + "text_15": [ + " outermost text at the end with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ] +} \ No newline at end of file diff --git a/test/bundled/compound-binding-element/compound-binding-element.js b/test/bundled/compound-binding-element/compound-binding-element.js new file mode 100644 index 00000000..8e43f4d7 --- /dev/null +++ b/test/bundled/compound-binding-element/compound-binding-element.js @@ -0,0 +1,791 @@ +/** +@license https://github.com/t2ym/i18n-behavior/blob/master/LICENSE.md +Copyright (c) 2016, Tetsuya Mori . All rights reserved. +*/ +import 'i18n-behavior/i18n-behavior.js'; + +import { html } from '@polymer/polymer/lib/utils/html-tag.js'; +import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; +import { LegacyElementMixin } from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; +import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; +import deepcopy from 'deepcopy/dist/deepcopy.js'; +const $_documentContainer = document.createElement('template'); + +$_documentContainer.innerHTML = ``; + +document.head.appendChild($_documentContainer.content); +switch (syntax) { +default: +case 'mixin': + { + class CompoundBindingElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)) { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text.0}}{{param1}}{{param2}}
+   +

{{text.h1_3.0}}{{param1}}{{param2}}

{{text.text_4.0}}{{param1}}{{param2}}{{text.span_5.0}}{{param1}}{{param2}} + {{text.span_6.0}}{{param1}}{{param2}} + {{text.label-1.0}}{{param1}}{{param2}} + {{text.label-2.0}}{{param1}}{{param2}} +
+ {{text.div_9:span.0}}{{param1}}{{param2}} + {{text.div_9:span_1.0}}{{param1}}{{param2}} +
{{text.div_9:div_2:div.0}}{{param1}}{{param2}}
+
+
{{text.div_10:text.0}}{{param1}}{{param2}}{{text.div_10:span_1.0}}{{param1}}{{param2}}{{text.div_10:text_2.0}}{{param1}}{{param2}}{{text.div_10:span_3.0}}{{param1}}{{param2}} +
{{text.div_10:div_4:div.0}}{{param1}}{{param2}}
{{text.div_10:text_5.0}}{{param1}}{{param2}}
+
+ {{text.toplevel-div:span.0}}{{param1}}{{param2}} + {{text.toplevel-div:span_1.0}}{{param1}}{{param2}} +
+
{{text.third-level-div.0}}{{param1}}{{param2}}
+
{{text.second-level-div:div_1.0}}{{param1}}{{param2}}
+
+
+
+
    +
  • {{text.div_12:ul:li.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_2.0}}{{param1}}{{param2}}
  • +
+
    +
  • {{text.line-items:li.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_2.0}}{{param1}}{{param2}}
  • +
+
+

{{text.p_13.0}}{{param1}}{{param2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{param1}}{{param2}}{{text.paragraph.4}}

{{text.text_15.0}}{{param1}}{{param2}} +`); + } + + static get is() { return 'compound-binding-element' } + static get properties () { + return { + param1: { + type: String, + value: 'parameter 1' + }, + param2: { + type: String, + value: 'parameter 2' + } + }; + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(CompoundBindingElement.is, CompoundBindingElement); + } + break; +case 'base-element': + { + class CompoundBindingElement extends BaseElements.I18nElement { + static get importMeta() { + return import.meta; + } + + static get template() { + return ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text.0}}{{param1}}{{param2}}
+   +

{{text.h1_3.0}}{{param1}}{{param2}}

{{text.text_4.0}}{{param1}}{{param2}}{{text.span_5.0}}{{param1}}{{param2}} + {{text.span_6.0}}{{param1}}{{param2}} + {{text.label-1.0}}{{param1}}{{param2}} + {{text.label-2.0}}{{param1}}{{param2}} +
+ {{text.div_9:span.0}}{{param1}}{{param2}} + {{text.div_9:span_1.0}}{{param1}}{{param2}} +
{{text.div_9:div_2:div.0}}{{param1}}{{param2}}
+
+
{{text.div_10:text.0}}{{param1}}{{param2}}{{text.div_10:span_1.0}}{{param1}}{{param2}}{{text.div_10:text_2.0}}{{param1}}{{param2}}{{text.div_10:span_3.0}}{{param1}}{{param2}} +
{{text.div_10:div_4:div.0}}{{param1}}{{param2}}
{{text.div_10:text_5.0}}{{param1}}{{param2}}
+
+ {{text.toplevel-div:span.0}}{{param1}}{{param2}} + {{text.toplevel-div:span_1.0}}{{param1}}{{param2}} +
+
{{text.third-level-div.0}}{{param1}}{{param2}}
+
{{text.second-level-div:div_1.0}}{{param1}}{{param2}}
+
+
+
+
    +
  • {{text.div_12:ul:li.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_2.0}}{{param1}}{{param2}}
  • +
+
    +
  • {{text.line-items:li.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_2.0}}{{param1}}{{param2}}
  • +
+
+

{{text.p_13.0}}{{param1}}{{param2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{param1}}{{param2}}{{text.paragraph.4}}

{{text.text_15.0}}{{param1}}{{param2}} +`); + } + + static get is() { return 'compound-binding-element' } + static get properties () { + return { + param1: { + type: String, + value: 'parameter 1' + }, + param2: { + type: String, + value: 'parameter 2' + } + } + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + } + customElements.define(CompoundBindingElement.is, CompoundBindingElement); + } + break; +case 'thin': + { + Define = class CompoundBindingElement extends BaseElements.I18nElement { + + static get importMeta() { + return import.meta; + } + + static get properties () { + return { + param1: { + type: String, + value: 'parameter 1' + }, + param2: { + type: String, + value: 'parameter 2' + } + } + } + + ready() { + this.addEventListener('lang-updated', this._langUpdated); + super.ready(); + } + + _langUpdated (e) { + console.log(this.is, 'lang-updated', e.detail); + if (e.composedPath()[0] === this) { + this.model = deepcopy(this.text.model); + } + } + }; + } + break; +case 'legacy': + { + Polymer({ + importMeta: import.meta, + + _template: ((t) => { t.setAttribute("localizable-text", "embedded"); return t; })(html`{{text.text.0}}{{param1}}{{param2}}
+   +

{{text.h1_3.0}}{{param1}}{{param2}}

{{text.text_4.0}}{{param1}}{{param2}}{{text.span_5.0}}{{param1}}{{param2}} + {{text.span_6.0}}{{param1}}{{param2}} + {{text.label-1.0}}{{param1}}{{param2}} + {{text.label-2.0}}{{param1}}{{param2}} +
+ {{text.div_9:span.0}}{{param1}}{{param2}} + {{text.div_9:span_1.0}}{{param1}}{{param2}} +
{{text.div_9:div_2:div.0}}{{param1}}{{param2}}
+
+
{{text.div_10:text.0}}{{param1}}{{param2}}{{text.div_10:span_1.0}}{{param1}}{{param2}}{{text.div_10:text_2.0}}{{param1}}{{param2}}{{text.div_10:span_3.0}}{{param1}}{{param2}} +
{{text.div_10:div_4:div.0}}{{param1}}{{param2}}
{{text.div_10:text_5.0}}{{param1}}{{param2}}
+
+ {{text.toplevel-div:span.0}}{{param1}}{{param2}} + {{text.toplevel-div:span_1.0}}{{param1}}{{param2}} +
+
{{text.third-level-div.0}}{{param1}}{{param2}}
+
{{text.second-level-div:div_1.0}}{{param1}}{{param2}}
+
+
+
+
    +
  • {{text.div_12:ul:li.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.div_12:ul:li_2.0}}{{param1}}{{param2}}
  • +
+
    +
  • {{text.line-items:li.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_1.0}}{{param1}}{{param2}}
  • +
  • {{text.line-items:li_2.0}}{{param1}}{{param2}}
  • +
+
+

{{text.p_13.0}}{{param1}}{{param2}}

+

{{text.paragraph.0}}{{text.paragraph.1}}{{param1}}{{param2}}{{text.paragraph.4}}

{{text.text_15.0}}{{param1}}{{param2}} +`), + + is: 'compound-binding-element', + + behaviors: [ + BehaviorsStore.I18nBehavior + ], + + properties: { + param1: { + type: String, + value: 'parameter 1' + }, + param2: { + type: String, + value: 'parameter 2' + } + }, + + listeners: { + 'lang-updated': '_langUpdated' + }, + + ready: function () { + //this.observeHtmlLang = false; + }, + + attached: function () { + }, + + _langUpdated: function (e) { + console.log(this.is, 'lang-updated', e.detail); + if (dom(e).rootTarget === this) { + this.model = deepcopy(this.text.model); + } + } + }); + } + break; +} diff --git a/test/bundled/compound-binding-element/compound-binding-element.json b/test/bundled/compound-binding-element/compound-binding-element.json new file mode 100644 index 00000000..87338aff --- /dev/null +++ b/test/bundled/compound-binding-element/compound-binding-element.json @@ -0,0 +1,151 @@ +{ + "meta": {}, + "model": {}, + "text": [ + " outermost text at the beginning with compound {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "h1_3": [ + "outermost header 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "text_4": [ + " outermost text in the middle with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "span_5": [ + "simple text without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "span_6": [ + "simple text without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-1": [ + "simple text with id and {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-2": [ + "simple text with id and {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:span": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_9:span_1": [ + "simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:div_2:div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text": [ + " simple text as the first element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_1": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_2": [ + " simple text in the middle of div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_3": [ + "simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_10:div_4:div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_5": [ + " simple text at the last element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span": [ + "simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span_1": [ + "simple text within div 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "third-level-div": [ + "great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "second-level-div:div_1": [ + "great grandchild text within div without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li": [ + "line item without id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_1": [ + "line item without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_2": [ + "line item without id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li": [ + "line item with id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_1": [ + "line item with id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_2": [ + "line item with id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "p_13": [ + "A paragraph with {1} is converted to {2}.", + "{{param1}}", + "{{param2}}" + ], + "paragraph": [ + "A paragraph with {1}, {2}, and {3} is converted to {4}.", + "id", + "{{param1}}", + "{{param2}}", + "" + ], + "text_15": [ + " outermost text at the end with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ] +} \ No newline at end of file diff --git a/test/bundled/compound-binding-element/locales/compound-binding-element.fr.json b/test/bundled/compound-binding-element/locales/compound-binding-element.fr.json new file mode 100755 index 00000000..fef07d0a --- /dev/null +++ b/test/bundled/compound-binding-element/locales/compound-binding-element.fr.json @@ -0,0 +1,153 @@ +{ + "meta": { + "todo": [] + }, + "model": {}, + "text": [ + " fr outermost text at the beginning with compound {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "h1_3": [ + "fr outermost header 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "text_4": [ + " fr outermost text in the middle with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "span_5": [ + "fr simple text without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "span_6": [ + "fr simple text without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-1": [ + "fr simple text with id and {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "label-2": [ + "fr simple text with id and {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:span": [ + "fr simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_9:span_1": [ + "fr simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_9:div_2:div": [ + "fr great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text": [ + " fr simple text as the first element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_1": [ + "fr simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_2": [ + " fr simple text in the middle of div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "div_10:span_3": [ + "fr simple text within div with {1} and {2} variables 2", + "{{param1}}", + "{{param2}}" + ], + "div_10:div_4:div": [ + "fr great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_10:text_5": [ + " fr simple text at the last element in div with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span": [ + "fr simple text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "toplevel-div:span_1": [ + "fr simple text within div 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "third-level-div": [ + "fr great grandchild text within div with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "second-level-div:div_1": [ + "fr great grandchild text within div without id with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li": [ + "fr line item without id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_1": [ + "fr line item without id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "div_12:ul:li_2": [ + "fr line item without id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li": [ + "fr line item with id 1 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_1": [ + "fr line item with id 2 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "line-items:li_2": [ + "fr line item with id 3 with {1} and {2} variables", + "{{param1}}", + "{{param2}}" + ], + "p_13": [ + "fr A paragraph with {1} is converted to {2}.", + "{{param1}}", + "{{param2}}" + ], + "paragraph": [ + "fr A paragraph with {1}, {2}, and {3} is converted to {4}.", + "fr id", + "{{param1}}", + "{{param2}}", + "fr " + ], + "text_15": [ + " fr outermost text at the end with {1} and {2} variables ", + "{{param1}}", + "{{param2}}" + ] +} \ No newline at end of file diff --git a/test/bundled/edge-case-dom-bind.json b/test/bundled/edge-case-dom-bind.json new file mode 100644 index 00000000..4577c44d --- /dev/null +++ b/test/bundled/edge-case-dom-bind.json @@ -0,0 +1,29 @@ +{ + "meta": {}, + "model": {}, + "text": [ + " name = {1} ", + "{{text.name}}" + ], + "i18n-number_1": "1", + "i18n-format_2": [ + "{{text.format}}", + "1" + ], + "i18n-format_3": [ + "format", + "" + ], + "p_8": [ + "hello {1}{2} {3} world", + "
", + "", + "" + ], + "p_9": [ + "hello{1}world", + "
" + ], + "text_10": " hello ", + "text_14": " world " +} \ No newline at end of file diff --git a/test/bundled/edge-case-test-imports.js b/test/bundled/edge-case-test-imports.js new file mode 100644 index 00000000..0a975222 --- /dev/null +++ b/test/bundled/edge-case-test-imports.js @@ -0,0 +1,9684 @@ +/** +@license +Copyright (c) 2017 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ /* eslint-disable no-unused-vars */ /** + * When using Closure Compiler, JSCompiler_renameProperty(property, object) is replaced by the munged name for object[property] + * We cannot alias this function, so we have to use a small shim that has the same behavior when not compiling. + * + * @param {string} prop Property name + * @param {?Object} obj Reference object + * @return {string} Potentially renamed property name + */window.JSCompiler_renameProperty=function(prop,obj){return prop;};/* eslint-enable */let CSS_URL_RX=/(url\()([^)]*)(\))/g;let ABS_URL=/(^\/)|(^#)|(^[\w-\d]*:)/;let workingURL;let resolveDoc;/** + * Resolves the given URL against the provided `baseUri'. + * + * Note that this function performs no resolution for URLs that start + * with `/` (absolute URLs) or `#` (hash identifiers). For general purpose + * URL resolution, use `window.URL`. + * + * @param {string} url Input URL to resolve + * @param {?string=} baseURI Base URI to resolve the URL against + * @return {string} resolved URL + */function resolveUrl(url,baseURI){if(url&&ABS_URL.test(url)){return url;}// Lazy feature detection. +if(workingURL===undefined){workingURL=false;try{const u=new URL('b','http://a');u.pathname='c%20d';workingURL=u.href==='http://a/c%20d';}catch(e){// silently fail +}}if(!baseURI){baseURI=document.baseURI||window.location.href;}if(workingURL){return new URL(url,baseURI).href;}// Fallback to creating an anchor into a disconnected document. +if(!resolveDoc){resolveDoc=document.implementation.createHTMLDocument('temp');resolveDoc.base=resolveDoc.createElement('base');resolveDoc.head.appendChild(resolveDoc.base);resolveDoc.anchor=resolveDoc.createElement('a');resolveDoc.body.appendChild(resolveDoc.anchor);}resolveDoc.base.href=baseURI;resolveDoc.anchor.href=url;return resolveDoc.anchor.href||url;}/** + * Resolves any relative URL's in the given CSS text against the provided + * `ownerDocument`'s `baseURI`. + * + * @param {string} cssText CSS text to process + * @param {string} baseURI Base URI to resolve the URL against + * @return {string} Processed CSS text with resolved URL's + */function resolveCss(cssText,baseURI){return cssText.replace(CSS_URL_RX,function(m,pre,url,post){return pre+'\''+resolveUrl(url.replace(/["']/g,''),baseURI)+'\''+post;});}/** + * Returns a path from a given `url`. The path includes the trailing + * `/` from the url. + * + * @param {string} url Input URL to transform + * @return {string} resolved path + */function pathFromUrl(url){return url.substring(0,url.lastIndexOf('/')+1);}var resolveUrl$1={resolveUrl:resolveUrl,resolveCss:resolveCss,pathFromUrl:pathFromUrl};const useShadow=!window.ShadyDOM;const useNativeCSSProperties=Boolean(!window.ShadyCSS||window.ShadyCSS.nativeCss);const useNativeCustomElements=!window.customElements.polyfillWrapFlushCallback;/** + * Globally settable property that is automatically assigned to + * `ElementMixin` instances, useful for binding in templates to + * make URL's relative to an application's root. Defaults to the main + * document URL, but can be overridden by users. It may be useful to set + * `rootPath` to provide a stable application mount path when + * using client side routing. + */let rootPath=undefined||pathFromUrl(document.baseURI||window.location.href);/** + * Sets the global rootPath property used by `ElementMixin` and + * available via `rootPath`. + * + * @param {string} path The new root path + * @return {void} + */const setRootPath=function(path){rootPath=path;};/** + * A global callback used to sanitize any value before inserting it into the DOM. + * The callback signature is: + * + * function sanitizeDOMValue(value, name, type, node) { ... } + * + * Where: + * + * `value` is the value to sanitize. + * `name` is the name of an attribute or property (for example, href). + * `type` indicates where the value is being inserted: one of property, attribute, or text. + * `node` is the node where the value is being inserted. + * + * @type {(function(*,string,string,Node):*)|undefined} + */let sanitizeDOMValue=window.Polymer&&window.Polymer.sanitizeDOMValue||undefined;/** + * Sets the global sanitizeDOMValue available via this module's exported + * `sanitizeDOMValue` variable. + * + * @param {(function(*,string,string,Node):*)|undefined} newSanitizeDOMValue the global sanitizeDOMValue callback + * @return {void} + */const setSanitizeDOMValue=function(newSanitizeDOMValue){sanitizeDOMValue=newSanitizeDOMValue;};/** + * Globally settable property to make Polymer Gestures use passive TouchEvent listeners when recognizing gestures. + * When set to `true`, gestures made from touch will not be able to prevent scrolling, allowing for smoother + * scrolling performance. + * Defaults to `false` for backwards compatibility. + */let passiveTouchGestures=false;/** + * Sets `passiveTouchGestures` globally for all elements using Polymer Gestures. + * + * @param {boolean} usePassive enable or disable passive touch gestures globally + * @return {void} + */const setPassiveTouchGestures=function(usePassive){passiveTouchGestures=usePassive;};/** + * Setting to ensure Polymer template evaluation only occurs based on tempates + * defined in trusted script. When true, `` re-registration is + * disallowed, `` is disabled, and ``/`` + * templates will only evaluate in the context of a trusted element template. + */let strictTemplatePolicy=false;/** + * Sets `strictTemplatePolicy` globally for all elements + * + * @param {boolean} useStrictPolicy enable or disable strict template policy + * globally + * @return {void} + */const setStrictTemplatePolicy=function(useStrictPolicy){strictTemplatePolicy=useStrictPolicy;};/** + * Setting to enable dom-module lookup from Polymer.Element. By default, + * templates must be defined in script using the `static get template()` + * getter and the `html` tag function. To enable legacy loading of templates + * via dom-module, set this flag to true. + */let allowTemplateFromDomModule=false;/** + * Sets `lookupTemplateFromDomModule` globally for all elements + * + * @param {boolean} allowDomModule enable or disable template lookup + * globally + * @return {void} + */const setAllowTemplateFromDomModule=function(allowDomModule){allowTemplateFromDomModule=allowDomModule;};var settings={useShadow:useShadow,useNativeCSSProperties:useNativeCSSProperties,useNativeCustomElements:useNativeCustomElements,get rootPath(){return rootPath;},setRootPath:setRootPath,get sanitizeDOMValue(){return sanitizeDOMValue;},setSanitizeDOMValue:setSanitizeDOMValue,get passiveTouchGestures(){return passiveTouchGestures;},setPassiveTouchGestures:setPassiveTouchGestures,get strictTemplatePolicy(){return strictTemplatePolicy;},setStrictTemplatePolicy:setStrictTemplatePolicy,get allowTemplateFromDomModule(){return allowTemplateFromDomModule;},setAllowTemplateFromDomModule:setAllowTemplateFromDomModule};let dedupeId=0;/** + * @constructor + * @extends {Function} + * @private + */function MixinFunction(){}/** @type {(WeakMap | undefined)} */MixinFunction.prototype.__mixinApplications;/** @type {(Object | undefined)} */MixinFunction.prototype.__mixinSet;/* eslint-disable valid-jsdoc */ /** + * Wraps an ES6 class expression mixin such that the mixin is only applied + * if it has not already been applied its base argument. Also memoizes mixin + * applications. + * + * @template T + * @param {T} mixin ES6 class expression mixin to wrap + * @return {T} + * @suppress {invalidCasts} + */const dedupingMixin=function(mixin){let mixinApplications=/** @type {!MixinFunction} */mixin.__mixinApplications;if(!mixinApplications){mixinApplications=new WeakMap();/** @type {!MixinFunction} */mixin.__mixinApplications=mixinApplications;}// maintain a unique id for each mixin +let mixinDedupeId=dedupeId++;function dedupingMixin(base){let baseSet=/** @type {!MixinFunction} */base.__mixinSet;if(baseSet&&baseSet[mixinDedupeId]){return base;}let map=mixinApplications;let extended=map.get(base);if(!extended){extended=/** @type {!Function} */mixin(base);map.set(base,extended);}// copy inherited mixin set from the extended class, or the base class +// NOTE: we avoid use of Set here because some browser (IE11) +// cannot extend a base Set via the constructor. +let mixinSet=Object.create(/** @type {!MixinFunction} */extended.__mixinSet||baseSet||null);mixinSet[mixinDedupeId]=true;/** @type {!MixinFunction} */extended.__mixinSet=mixinSet;return extended;}return dedupingMixin;};/* eslint-enable valid-jsdoc */var mixin={dedupingMixin:dedupingMixin};let modules={};let lcModules={};/** + * Sets a dom-module into the global registry by id. + * + * @param {string} id dom-module id + * @param {DomModule} module dom-module instance + * @return {void} + */function setModule(id,module){// store id separate from lowercased id so that +// in all cases mixedCase id will stored distinctly +// and lowercase version is a fallback +modules[id]=lcModules[id.toLowerCase()]=module;}/** + * Retrieves a dom-module from the global registry by id. + * + * @param {string} id dom-module id + * @return {DomModule!} dom-module instance + */function findModule(id){return modules[id]||lcModules[id.toLowerCase()];}function styleOutsideTemplateCheck(inst){if(inst.querySelector('style')){console.warn('dom-module %s has style outside template',inst.id);}}/** + * The `dom-module` element registers the dom it contains to the name given + * by the module's id attribute. It provides a unified database of dom + * accessible via its static `import` API. + * + * A key use case of `dom-module` is for providing custom element ``;document.head.appendChild($_documentContainer$5.content);switch(syntax){default:case"mixin":{class AdvancedBindingElement extends Mixins.Localizable(LegacyElementMixin(HTMLElement)){static get importMeta(){return bundledImportMeta$a}static get template(){return(t=>{t.setAttribute("localizable-text","embedded");return t})(html` {{tr(status,text.statusMessages)}} {{or(value,text.defaultValue)}} @@ -9544,10 +597,7 @@ assert.equal(getProperty(nodes[0],p),translate(params.effectiveLang,p,childPath[ } -`);}static get is(){return'advanced-binding-element';}static get properties(){return{status:{type:String,value:'ok'},value:{type:String},parameter:{type:String}};}ready(){this.addEventListener('lang-updated',this._langUpdated);this.addEventListener('rendered',this._rendered);super.ready();}connectedCallback(){//console.log('advanced-binding-element: connected'); -super.connectedCallback();}disconnectedCallback(){super.disconnectedCallback();//console.log('advanced-binding-element: disconnected'); -}_langUpdated(e){console.log('lang-updated',e.composedPath()[0],e.target,e.detail,'lang = '+this.lang,'effectiveLang = '+this.effectiveLang);if(e.composedPath()[0]===this/*&& - this.effectiveLang === this.lang*/){this.model=deepcopy(this.text.model);this._checkLang();}}_rendered(e){console.log('rendered',e.composedPath()[0],e.target,e.detail,'lang = '+this.lang,'effectiveLang = '+this.effectiveLang,'e.target.lang = '+e.target.lang);this._checkLang();}_checkLang(){var i18nFormats=this.root.querySelectorAll('i18n-format');var allLangUpdated=this.lang===this.effectiveLang;Array.prototype.forEach.call(i18nFormats,function(el){if(el.lang!==this.lang){allLangUpdated=false;}else{el.render();}}.bind(this));if(allLangUpdated){console.log(this.is+' local-dom-ready');this.fire('local-dom-ready');}}}customElements.define(AdvancedBindingElement.is,AdvancedBindingElement);}break;case'base-element':{class AdvancedBindingElement extends BaseElements.I18nElement{static get importMeta(){return bundledImportMeta$a;}static get template(){return(t=>{t.setAttribute("localizable-text","embedded");return t;})(html` +`)}static get is(){return"advanced-binding-element"}static get properties(){return{status:{type:String,value:"ok"},value:{type:String},parameter:{type:String}}}ready(){this.addEventListener("lang-updated",this._langUpdated);this.addEventListener("rendered",this._rendered);super.ready()}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}_langUpdated(e){console.log("lang-updated",e.composedPath()[0],e.target,e.detail,"lang = "+this.lang,"effectiveLang = "+this.effectiveLang);if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);this._checkLang()}}_rendered(e){console.log("rendered",e.composedPath()[0],e.target,e.detail,"lang = "+this.lang,"effectiveLang = "+this.effectiveLang,"e.target.lang = "+e.target.lang);this._checkLang()}_checkLang(){var i18nFormats=this.root.querySelectorAll("i18n-format"),allLangUpdated=this.lang===this.effectiveLang;Array.prototype.forEach.call(i18nFormats,function(el){if(el.lang!==this.lang){allLangUpdated=!1}else{el.render()}}.bind(this));if(allLangUpdated){console.log(this.is+" local-dom-ready");this.fire("local-dom-ready")}}}customElements.define(AdvancedBindingElement.is,AdvancedBindingElement)}break;case"base-element":{class AdvancedBindingElement extends BaseElements.I18nElement{static get importMeta(){return bundledImportMeta$a}static get template(){return(t=>{t.setAttribute("localizable-text","embedded");return t})(html` {{tr(status,text.statusMessages)}} {{or(value,text.defaultValue)}} @@ -9609,13 +659,7 @@ super.connectedCallback();}disconnectedCallback(){super.disconnectedCallback();/ } -`);}static get is(){return'advanced-binding-element';}static get properties(){return{status:{type:String,value:'ok'},value:{type:String},parameter:{type:String}};}ready(){this.addEventListener('lang-updated',this._langUpdated);this.addEventListener('rendered',this._rendered);super.ready();}connectedCallback(){//console.log('advanced-binding-element: connected'); -super.connectedCallback();}disconnectedCallback(){super.disconnectedCallback();//console.log('advanced-binding-element: disconnected'); -}_langUpdated(e){console.log('lang-updated',e.composedPath()[0],e.target,e.detail,'lang = '+this.lang,'effectiveLang = '+this.effectiveLang);if(e.composedPath()[0]===this/*&& - this.effectiveLang === this.lang*/){this.model=deepcopy(this.text.model);this._checkLang();}}_rendered(e){console.log('rendered',e.composedPath()[0],e.target,e.detail,'lang = '+this.lang,'effectiveLang = '+this.effectiveLang,'e.target.lang = '+e.target.lang);this._checkLang();}_checkLang(){var i18nFormats=this.root.querySelectorAll('i18n-format');var allLangUpdated=this.lang===this.effectiveLang;Array.prototype.forEach.call(i18nFormats,function(el){if(el.lang!==this.lang){allLangUpdated=false;}else{el.render();}}.bind(this));if(allLangUpdated){this.fire('local-dom-ready');}}}customElements.define(AdvancedBindingElement.is,AdvancedBindingElement);}break;case'thin':{Define=class AdvancedBindingElement extends BaseElements.I18nElement{static get importMeta(){return bundledImportMeta$a;}static get properties(){return{status:{type:String,value:'ok'},value:{type:String},parameter:{type:String}};}ready(){this.addEventListener('lang-updated',this._langUpdated);this.addEventListener('rendered',this._rendered);super.ready();}connectedCallback(){//console.log('advanced-binding-element: connected'); -super.connectedCallback();}disconnectedCallback(){super.disconnectedCallback();//console.log('advanced-binding-element: disconnected'); -}_langUpdated(e){console.log('lang-updated',e.composedPath()[0],e.target,e.detail,'lang = '+this.lang,'effectiveLang = '+this.effectiveLang);if(e.composedPath()[0]===this/*&& - this.effectiveLang === this.lang*/){this.model=deepcopy(this.text.model);this._checkLang();}}_rendered(e){console.log('rendered',e.composedPath()[0],e.target,e.detail,'lang = '+this.lang,'effectiveLang = '+this.effectiveLang,'e.target.lang = '+e.target.lang);this._checkLang();}_checkLang(){var i18nFormats=this.root.querySelectorAll('i18n-format');var allLangUpdated=this.lang===this.effectiveLang;Array.prototype.forEach.call(i18nFormats,function(el){if(el.lang!==this.lang){allLangUpdated=false;}else{el.render();}}.bind(this));if(allLangUpdated){this.fire('local-dom-ready');}}};}break;case'legacy':{Polymer$1({importMeta:bundledImportMeta$a,_template:(t=>{t.setAttribute("localizable-text","embedded");return t;})(html` +`)}static get is(){return"advanced-binding-element"}static get properties(){return{status:{type:String,value:"ok"},value:{type:String},parameter:{type:String}}}ready(){this.addEventListener("lang-updated",this._langUpdated);this.addEventListener("rendered",this._rendered);super.ready()}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}_langUpdated(e){console.log("lang-updated",e.composedPath()[0],e.target,e.detail,"lang = "+this.lang,"effectiveLang = "+this.effectiveLang);if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);this._checkLang()}}_rendered(e){console.log("rendered",e.composedPath()[0],e.target,e.detail,"lang = "+this.lang,"effectiveLang = "+this.effectiveLang,"e.target.lang = "+e.target.lang);this._checkLang()}_checkLang(){var i18nFormats=this.root.querySelectorAll("i18n-format"),allLangUpdated=this.lang===this.effectiveLang;Array.prototype.forEach.call(i18nFormats,function(el){if(el.lang!==this.lang){allLangUpdated=!1}else{el.render()}}.bind(this));if(allLangUpdated){this.fire("local-dom-ready")}}}customElements.define(AdvancedBindingElement.is,AdvancedBindingElement)}break;case"thin":{Define=class AdvancedBindingElement extends BaseElements.I18nElement{static get importMeta(){return bundledImportMeta$a}static get properties(){return{status:{type:String,value:"ok"},value:{type:String},parameter:{type:String}}}ready(){this.addEventListener("lang-updated",this._langUpdated);this.addEventListener("rendered",this._rendered);super.ready()}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}_langUpdated(e){console.log("lang-updated",e.composedPath()[0],e.target,e.detail,"lang = "+this.lang,"effectiveLang = "+this.effectiveLang);if(e.composedPath()[0]===this){this.model=deepcopy(this.text.model);this._checkLang()}}_rendered(e){console.log("rendered",e.composedPath()[0],e.target,e.detail,"lang = "+this.lang,"effectiveLang = "+this.effectiveLang,"e.target.lang = "+e.target.lang);this._checkLang()}_checkLang(){var i18nFormats=this.root.querySelectorAll("i18n-format"),allLangUpdated=this.lang===this.effectiveLang;Array.prototype.forEach.call(i18nFormats,function(el){if(el.lang!==this.lang){allLangUpdated=!1}else{el.render()}}.bind(this));if(allLangUpdated){this.fire("local-dom-ready")}}}}break;case"legacy":{Polymer$1({importMeta:bundledImportMeta$a,_template:(t=>{t.setAttribute("localizable-text","embedded");return t})(html` {{tr(status,text.statusMessages)}} {{or(value,text.defaultValue)}} @@ -9677,8 +721,4 @@ super.connectedCallback();}disconnectedCallback(){super.disconnectedCallback();/ } -`),is:'advanced-binding-element',behaviors:[BehaviorsStore.I18nBehavior],properties:{status:{type:String,value:'ok'},value:{type:String},parameter:{type:String}},observers:[],listeners:{'lang-updated':'_langUpdated','rendered':'_rendered'},ready:function(){//this.observeHtmlLang = false; -},attached:function(){//console.log('advanced-binding-element: attached'); -},detached:function(){//console.log('advanced-binding-element: detached'); -},_langUpdated:function(e){console.log('lang-updated',e.composedPath()[0],e.target,e.detail,'lang = '+this.lang,'effectiveLang = '+this.effectiveLang);if(dom(e).rootTarget===this){this.model=deepcopy(this.text.model);this._checkLang();}},_rendered:function(e){console.log('rendered',e.composedPath()[0],e.target,e.detail,'lang = '+this.lang,'effectiveLang = '+this.effectiveLang,'e.target.lang = '+e.target.lang);this._checkLang();},_checkLang:function(){var i18nFormats=this.root.querySelectorAll('i18n-format');var allLangUpdated=this.lang===this.effectiveLang;Array.prototype.forEach.call(i18nFormats,function(el){if(el.lang!==this.lang){allLangUpdated=false;}else{el.render();}}.bind(this));if(allLangUpdated){this.fire('local-dom-ready');}}});}break;}suite('I18nElement with '+(window.location.href.indexOf('?dom=Shadow')>=0?'Shadow DOM':'Shady DOM')+(' in '+syntax+' syntax'),function(){var lang0='';var lang1='en';var lang2='fr';var lang3='ja';var lang4='fr-CA';var lang5='zh-Hans-CN';var lang6='ru';var lang7='zh-yue-Hans-CN';var lang8='zh-CN';var lang9='zh-TW';var lang10='zh-Hans-CN-x-Linux';var text_complex_compound_binding={'model':{},'item-update2:text':['updated: {1}, by: ','{{text.updated}}'],'item-update2:text_2':' xxx ','item-update2:dom-if_3:template:span:b':'IF CONTENT','item-update2:b_4':'abc','item-update2:dom-if_5:template:text':'IF CONTENT 2','item-update2:text_6':' hello ','item-update:text':['updated: {1}, by: ','{{text.updated}}'],'item-update:text_2':' xxx ','item-update:dom-if_3:template:b':'IF CONTENT','item-update:b_4':'abc','item-update:dom-if_5:template:text':'IF CONTENT 2','item-update:text_6':' hello ','item-update3:text':['updated: {1}, by: ','{{text.updated}}'],'item-update3:text_2':' xxx ','item-update3:dom-if_3:template:b':'IF','item-update3:dom-if_3:template:b_1':'CONTENT','item-update3:b_4':'abc','item-update3:dom-if_5:template:text':'IF CONTENT 2','item-update3:text_6':' hello ','item-update4:text':['updated: {1}, by: ','{{text.updated}}'],'item-update4:dom-repeat_1:template:text':[' {1} = {2} ','{{item.name}}','{{text.updated}}'],'item-update4:text_2':' xxx ','item-update4:dom-if_3:template:b':'IF CONTENT','item-update4:b_4':'abc','item-update4:dom-if_5:template:text':'IF CONTENT 2','item-update4:text_6':' hello ','paragraph:text':'A paragraph with ','paragraph:text_2':' is converted to ','paragraph:code_3':'','paragraph:text_4':'. ','paragraph2:text':'A paragraph with deep ','paragraph2:text_2':' is ','paragraph2:b_3':'not','paragraph2:text_4':' converted to ','paragraph2:code_5':'','paragraph2:text_6':'. ','authors':[{'name':'Joe'},{'name':'Alice'}],'updated':'Jan 1st, 2016','parameters':['parameter 1','parameter 2']};var localDOM_complex_compound_binding=[{select:'[id="item-update"] i18n-format','PolymerDom.childNodes.nonWS.0.textContent':text_complex_compound_binding['item-update:text'][0],'root.PolymerDom.effectiveChildNodes.nonWS.0.textContent':'updated: ','root.PolymerDom.effectiveChildNodes.nonWS.1.textContent.trim':text_complex_compound_binding.updated,'root.PolymerDom.effectiveChildNodes.nonWS.2.textContent.raw':', by: '},{select:'[id="item-update"]','PolymerDom.childNodes.nonWS.1.textContent.trim':text_complex_compound_binding.authors[0].name,'PolymerDom.childNodes.nonWS.2.textContent.trim':text_complex_compound_binding.authors[1].name,'PolymerDom.childNodes.nonWS.3.tagName':'DOM-REPEAT','PolymerDom.childNodes.nonWS.4.textContent':text_complex_compound_binding['item-update:text_2'],'PolymerDom.childNodes.nonWS.5.textContent.trim':text_complex_compound_binding['item-update:dom-if_3:template:b'],'PolymerDom.childNodes.nonWS.6.tagName':'DOM-IF','PolymerDom.childNodes.nonWS.7.textContent.trim':text_complex_compound_binding['item-update:b_4'],'PolymerDom.childNodes.nonWS.8.textContent.trim':text_complex_compound_binding['item-update:dom-if_5:template:text'],'PolymerDom.childNodes.nonWS.9.tagName':'DOM-IF','PolymerDom.childNodes.nonWS.10.textContent':text_complex_compound_binding['item-update:text_6']},{select:'[id="item-update2"] i18n-format','PolymerDom.childNodes.nonWS.0.textContent':text_complex_compound_binding['item-update2:text'][0],'root.PolymerDom.effectiveChildNodes.nonWS.1.textContent.trim':text_complex_compound_binding.updated,'root.PolymerDom.effectiveChildNodes.nonWS.2.textContent.raw':', by: '},{select:'[id="item-update2"]','PolymerDom.childNodes.nonWS.1.data.trim':text_complex_compound_binding.authors[0].name,'PolymerDom.childNodes.nonWS.2.data.trim':text_complex_compound_binding.authors[1].name,'PolymerDom.childNodes.nonWS.3.tagName':'DOM-REPEAT','PolymerDom.childNodes.nonWS.4.textContent':text_complex_compound_binding['item-update2:text_2'],'PolymerDom.childNodes.nonWS.5.childNodes.nonWS.0.textContent.trim':text_complex_compound_binding['item-update2:dom-if_3:template:span:b'],'PolymerDom.childNodes.nonWS.6.tagName':'DOM-IF','PolymerDom.childNodes.nonWS.7.textContent.trim':text_complex_compound_binding['item-update2:b_4'],'PolymerDom.childNodes.nonWS.8.data':text_complex_compound_binding['item-update2:dom-if_5:template:text'],'PolymerDom.childNodes.nonWS.9.tagName':'DOM-IF','PolymerDom.childNodes.nonWS.10.data':' hello '},{select:'[id="item-update3"]','PolymerDom.childNodes.nonWS.1.data.trim':text_complex_compound_binding.authors[0].name,'PolymerDom.childNodes.nonWS.2.data.trim':text_complex_compound_binding.authors[1].name,'PolymerDom.childNodes.nonWS.3.tagName':'DOM-REPEAT','PolymerDom.childNodes.nonWS.4.textContent':text_complex_compound_binding['item-update3:text_2'],'PolymerDom.childNodes.nonWS.5.childNodes.nonWS.0.textContent.trim':text_complex_compound_binding['item-update3:dom-if_3:template:b'],'PolymerDom.childNodes.nonWS.6.childNodes.nonWS.0.textContent.trim':text_complex_compound_binding['item-update3:dom-if_3:template:b_1'],'PolymerDom.childNodes.nonWS.7.tagName':'DOM-IF','PolymerDom.childNodes.nonWS.8.textContent.trim':text_complex_compound_binding['item-update3:b_4'],'PolymerDom.childNodes.nonWS.9.data':text_complex_compound_binding['item-update3:dom-if_5:template:text'],'PolymerDom.childNodes.nonWS.10.tagName':'DOM-IF','PolymerDom.childNodes.nonWS.11.data':' hello '},{select:'[id="item-update4"] i18n-format','PolymerDom.childNodes.nonWS.0.textContent':text_complex_compound_binding['item-update4:text'][0],'root.PolymerDom.effectiveChildNodes.nonWS.1.textContent.trim':text_complex_compound_binding.updated,'root.PolymerDom.effectiveChildNodes.nonWS.2.textContent.raw':', by: '},{select:'[id="item-update4"] i18n-format +i18n-format','PolymerDom.childNodes.nonWS.0.textContent':text_complex_compound_binding['item-update4:dom-repeat_1:template:text'][0],'PolymerDom.childNodes.nonWS.1.textContent.trim':text_complex_compound_binding.authors[0].name,'PolymerDom.childNodes.nonWS.2.textContent.trim':text_complex_compound_binding.updated},{select:'[id="item-update4"] i18n-format +i18n-format +i18n-format','PolymerDom.childNodes.nonWS.0.textContent':text_complex_compound_binding['item-update4:dom-repeat_1:template:text'][0],'PolymerDom.childNodes.nonWS.1.textContent.trim':text_complex_compound_binding.authors[1].name,'PolymerDom.childNodes.nonWS.2.textContent.trim':text_complex_compound_binding.updated},{select:'[id="item-update4"] dom-repeat','tagName':['DOM-REPEAT']},{select:'[id="item-update4"] dom-if','tagName':['DOM-IF','DOM-IF']},{select:'[id="item-update4"] dom-repeat','nextTextSibling.data':text_complex_compound_binding['item-update4:text_2']},{select:'[id="item-update4"] b','PolymerDom.textContent':[text_complex_compound_binding['item-update4:dom-if_3:template:b'],text_complex_compound_binding['item-update4:b_4']]},{select:'[id="item-update4"]','PolymerDom.childNodes.nonWS.8.data':text_complex_compound_binding['item-update4:dom-if_5:template:text'],'PolymerDom.childNodes.nonWS.10.data':' hello '},{select:'[id="paragraph"]','PolymerDom.childNodes.nonWS.0.textContent':text_complex_compound_binding['paragraph:text'],'PolymerDom.childNodes.nonWS.1.textContent.trim':text_complex_compound_binding.parameters[0],'PolymerDom.childNodes.nonWS.2.textContent.trim':text_complex_compound_binding.parameters[1]},{select:'[id="paragraph"] code','tagName':'CODE','textContent':text_complex_compound_binding['paragraph:code_3']},{select:'[id="paragraph2"]','PolymerDom.childNodes.nonWS.0.data':text_complex_compound_binding['paragraph2:text']},{select:'[id="paragraph2"] span i','textContent':text_complex_compound_binding.parameters},{select:'[id="paragraph2"] b','textContent':text_complex_compound_binding['paragraph2:b_3'],'previousTextSibling.data':text_complex_compound_binding['paragraph2:text_2'],'nextTextSibling.data':text_complex_compound_binding['paragraph2:text_4']},{select:'[id="paragraph2"] code','textContent':text_complex_compound_binding['paragraph2:code_5'],'nextTextSibling.data':text_complex_compound_binding['paragraph2:text_6']}];var text_advanced_binding={'meta':{},'model':{'aria-attributes':{'title':'tooltip text','aria-label':'aria label text','aria-valuetext':'aria value text'}},'annotated-format':['{{tr(status,text.statusMessageFormats)}}','{{parameter}}','string parameter'],'span_5':['{1} {2}','{{text.defaultValue}}','{{text.defaultValue}}'],'statusMessages':{'ok':'healthy status','busy':'busy status','error':'error status','default':'unknown status'},'defaultValue':'default value','statusMessageFormats':{'ok':'healthy status','busy':'busy status with {2}','error':'error status with {1} and {2}','default':'unknown status'},'nodefault':{'ok':'ok status'}};var localDOM_advanced_binding_1=[{select:'[id="status"]',textContent:'healthy status'},{select:'[id="default"]','textContent.raw':'initial value'},{select:'[id="annotated-format"]','root.PolymerDom.textContent':'healthy status'},{select:'[id="aria-attributes"]','attributes.title.value.text':'tooltip text','attributes.aria-label.value.text':'aria label text','attributes.aria-valuetext.value.text':'aria value text','bindValue.raw':'initial value'}];var localDOM_advanced_binding_2=[{select:'[id="status"]',textContent:'busy status'},{select:'[id="default"]',textContent:'default value'},{select:'[id="annotated-format"]','root.PolymerDom.effectiveChildNodes.nonWS.0.textContent':'busy status with ','root.PolymerDom.effectiveChildNodes.nonWS.1.textContent':'string parameter'},{select:'[id="aria-attributes"]','attributes.title.value.text':'tooltip text','attributes.aria-label.value.text':'aria label text','attributes.aria-valuetext.value.text':'aria value text','bindValue.raw':''}];var localDOM_advanced_binding_3=[{select:'[id="status"]',textContent:'error status'},{select:'[id="default"]',textContent:'default value'},{select:'[id="annotated-format"]','root.PolymerDom.effectiveChildNodes.nonWS.0.textContent':'error status with ','root.PolymerDom.effectiveChildNodes.nonWS.1.textContent.raw':'parameter text','root.PolymerDom.effectiveChildNodes.nonWS.2.textContent.raw':' and ','root.PolymerDom.effectiveChildNodes.nonWS.3.textContent':'string parameter'},{select:'[id="aria-attributes"]','attributes.title.value.text':'tooltip text','attributes.aria-label.value.text':'aria label text','attributes.aria-valuetext.value.text':'aria value text','bindValue.raw':null}];var localDOM_advanced_binding_4=[{select:'[id="status"]',textContent:'unknown status'},{select:'[id="default"]',textContent:'default value'},{select:'[id="annotated-format"]','root.PolymerDom.effectiveChildNodes.nonWS.0.textContent':'unknown status'},{select:'[id="aria-attributes"]','attributes.title.value.text':'tooltip text','attributes.aria-label.value.text':'aria label text','attributes.aria-valuetext.value.text':'aria value text','bindValue.raw':undefined}];var suites=[s('empty element',null,{fixture:'empty-element-fixture',fixtureModel:undefined,assign:undefined,lang:lang1,effectiveLang:lang1,templateDefaultLang:lang1,observeHtmlLang:true,//text: { model: {} }, -model:{},localDOM:undefined,lightDOM:undefined}),s(lang2+' empty element','empty element',{fixture:'bound-empty-element-fixture',fixtureModel:{observeHtmlLang:false,lang:lang1},assign:{lang:lang2},event:'lang-updated',lang:lang2,effectiveLang:lang2,observeHtmlLang:false}),s('no template element','empty element',{fixture:'no-template-element-fixture'}),s('complex compound binding element','empty element',{setup:true,fixture:'complex-compound-binding-element-fixture',fixtureModel:{observeHtmlLang:false,lang:lang0},assign:{lang:lang1},event:'local-dom-ready',lang:lang1,effectiveLang:lang1,observeHtmlLang:false,text:text_complex_compound_binding,localDOM:localDOM_complex_compound_binding}),s(lang2+' complex compound binding element','complex compound binding element',{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s('advanced binding element','empty element',{setup:true,fixture:'advanced-binding-element-fixture',fixtureModel:{observeHtmlLang:false,lang:lang0,status:'ok',value:'initial value',parameter:'parameter text'},assign:{lang:lang1},event:'local-dom-ready',lang:lang1,effectiveLang:lang1,observeHtmlLang:false,text:text_advanced_binding,model:text_advanced_binding.model,localDOM:localDOM_advanced_binding_1}),s('advanced binding element 2','advanced binding element',{fixtureModel:{observeHtmlLang:false,lang:lang0,status:'busy',value:'',parameter:'parameter text'},localDOM:localDOM_advanced_binding_2}),s('advanced binding element 3','advanced binding element',{fixtureModel:{observeHtmlLang:false,lang:lang0,status:'error',value:null,parameter:'parameter text'},localDOM:localDOM_advanced_binding_3}),s('advanced binding element 4','advanced binding element',{fixtureModel:{observeHtmlLang:false,lang:lang0,status:null,value:undefined,parameter:'parameter text'},localDOM:localDOM_advanced_binding_4}),s(lang2+' advanced binding element','advanced binding element',{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s(lang2+' advanced binding element 2','advanced binding element 2',{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s(lang2+' advanced binding element 3','advanced binding element 3',{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s(lang2+' advanced binding element 4','advanced binding element 4',{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s(lang7+' fallback','advanced binding element 4',{timeout:60000,assign:{lang:lang7},lang:lang0,effectiveLang:lang0}),s(lang8+' fallback',lang7+' fallback',{assign:{lang:lang8}}),s(lang9+' fallback',lang7+' fallback',{assign:{lang:lang9}}),s(lang10+' fallback',lang7+' fallback',{assign:{lang:lang10}})];suitesRunner(suites);});export{ironA11yAnnouncer as $ironA11yAnnouncer,ironMeta as $ironMeta,ironValidatableBehavior as $ironValidatableBehavior,arraySelector as $arraySelector,customStyle as $customStyle,domBind as $domBind,domIf as $domIf,domModule as $domModule,domRepeat as $domRepeat,_class as $class,legacyElementMixin as $legacyElementMixin,mutableDataBehavior as $mutableDataBehavior,polymerFn as $polymerFn,polymer_dom as $polymerDom,templatizerBehavior as $templatizerBehavior,dirMixin as $dirMixin,elementMixin as $elementMixin,gestureEventListeners as $gestureEventListeners,mutableData as $mutableData,propertiesChanged as $propertiesChanged,propertiesMixin as $propertiesMixin,propertyAccessors as $propertyAccessors,propertyEffects as $propertyEffects,templateStamp as $templateStamp,arraySplice as $arraySplice,async as $async,caseMap$1 as $caseMap,debounce as $debounce,flattenedNodesObserver as $flattenedNodesObserver,flush$2 as $flush,gestures$1 as $gestures,htmlTag as $htmlTag,mixin as $mixin,path as $path,renderStatus as $renderStatus,resolveUrl$1 as $resolveUrl,settings as $settings,styleGather as $styleGather,templatize$1 as $templatize,polymerElement as $polymerElement,polymerLegacy as $polymerLegacy,applyShimUtils as $applyShimUtils,applyShim as $applyShim$1,commonRegex as $commonRegex,commonUtils as $commonUtils,cssParse as $cssParse,customStyleInterface as $customStyleInterface$1,documentWait$1 as $documentWait,styleSettings as $styleSettings,styleUtil as $styleUtil,templateMap$1 as $templateMap,unscopedStyleHandler as $unscopedStyleHandler,deepcopy$1 as $deepcopy,plurals$1 as $plurals,IronA11yAnnouncer,IronMeta,IronValidatableBehaviorMeta,IronValidatableBehavior,ArraySelectorMixin,ArraySelector,CustomStyle,DomBind,DomIf,DomModule,DomRepeat,mixinBehaviors,Class,LegacyElementMixin,MutableDataBehavior,OptionalMutableDataBehavior,Polymer$1 as Polymer,flush$1 as flush,enqueueDebouncer as addDebouncer,matchesSelector,DomApi,EventApi,dom,Templatizer,DirMixin,version,ElementMixin,instanceCount,registrations,register,dumpRegistrations,updateStyles,GestureEventListeners,MutableData,OptionalMutableData,PropertiesChanged,PropertiesMixin,PropertyAccessors,PropertyEffects,TemplateStamp,calculateSplices,timeOut,animationFrame,idlePeriod,microTask,dashToCamelCase,camelToDashCase,Debouncer,FlattenedNodesObserver,enqueueDebouncer,flush$1,gestures,recognizers,deepTargetFind,addListener,removeListener,register$1,setTouchAction,prevent,resetMouseCanceller,findOriginalTarget,add,remove,html,htmlLiteral,dedupingMixin,isPath,root,isAncestor,isDescendant,translate$1 as translate,matches,normalize,split,get,set,isDeep,flush as flush$2,beforeNextRender,afterNextRender,resolveUrl,resolveCss,pathFromUrl,useShadow,useNativeCSSProperties,useNativeCustomElements,rootPath,setRootPath,sanitizeDOMValue,setSanitizeDOMValue,passiveTouchGestures,setPassiveTouchGestures,strictTemplatePolicy,setStrictTemplatePolicy,allowTemplateFromDomModule,setAllowTemplateFromDomModule,stylesFromModules,stylesFromModule,stylesFromTemplate,stylesFromModuleImports,cssFromModules,cssFromModule,cssFromTemplate,cssFromModuleImports,templatize,modelForElement,TemplateInstanceBase,html as html$1,version as version$1,PolymerElement,Polymer$1,html as html$2,Base,invalidate,invalidateTemplate,isValid,templateIsValid,isValidating,templateIsValidating,startValidating,startValidatingTemplate,elementsAreInvalid,ApplyShim as $applyShimDefault,VAR_ASSIGN,MIXIN_MATCH,VAR_CONSUMED,ANIMATION_MATCH,MEDIA_MATCH,IS_VAR,BRACKETED,HOST_PREFIX,HOST_SUFFIX,updateNativeProperties,getComputedStyleValue,detectMixin,StyleNode,parse,stringify,removeCustomPropAssignment,types,CustomStyleProvider,CustomStyleInterface as $customStyleInterfaceDefault,CustomStyleInterfaceInterface,documentWait as $documentWaitDefault,nativeShadow,cssBuild,nativeCssVariables,toCssText,rulesForStyle,isKeyframesSelector,forEachRule,applyCss,createScopeStyle,applyStylePlaceHolder,applyStyle,isTargetedBuild,findMatchingParen,processVariableAndFallback,setElementClassRaw,wrap,getIsExtends,gatherStyleText,splitSelectorList,getCssBuild,elementHasBuiltCss,getBuildComment,isOptimalCssBuild,templateMap as $templateMapDefault,scopingAttribute,processUnscopedStyle,isUnscopedStyle,deepcopy as $deepcopyDefault,plurals as $pluralsDefault}; \ No newline at end of file +`),is:"advanced-binding-element",behaviors:[BehaviorsStore.I18nBehavior],properties:{status:{type:String,value:"ok"},value:{type:String},parameter:{type:String}},observers:[],listeners:{"lang-updated":"_langUpdated",rendered:"_rendered"},ready:function(){},attached:function(){},detached:function(){},_langUpdated:function(e){console.log("lang-updated",e.composedPath()[0],e.target,e.detail,"lang = "+this.lang,"effectiveLang = "+this.effectiveLang);if(dom(e).rootTarget===this){this.model=deepcopy(this.text.model);this._checkLang()}},_rendered:function(e){console.log("rendered",e.composedPath()[0],e.target,e.detail,"lang = "+this.lang,"effectiveLang = "+this.effectiveLang,"e.target.lang = "+e.target.lang);this._checkLang()},_checkLang:function(){var i18nFormats=this.root.querySelectorAll("i18n-format"),allLangUpdated=this.lang===this.effectiveLang;Array.prototype.forEach.call(i18nFormats,function(el){if(el.lang!==this.lang){allLangUpdated=!1}else{el.render()}}.bind(this));if(allLangUpdated){this.fire("local-dom-ready")}}})}break;}suite("I18nElement with "+(0<=window.location.href.indexOf("?dom=Shadow")?"Shadow DOM":"Shady DOM")+(" in "+syntax+" syntax"),function(){var lang0="",lang1="en",lang2="fr",lang3="ja",lang4="fr-CA",lang5="zh-Hans-CN",lang6="ru",lang7="zh-yue-Hans-CN",lang8="zh-CN",lang9="zh-TW",lang10="zh-Hans-CN-x-Linux",text_complex_compound_binding={model:{},"item-update2:text":["updated: {1}, by: ","{{text.updated}}"],"item-update2:text_2":" xxx ","item-update2:dom-if_3:template:span:b":"IF CONTENT","item-update2:b_4":"abc","item-update2:dom-if_5:template:text":"IF CONTENT 2","item-update2:text_6":" hello ","item-update:text":["updated: {1}, by: ","{{text.updated}}"],"item-update:text_2":" xxx ","item-update:dom-if_3:template:b":"IF CONTENT","item-update:b_4":"abc","item-update:dom-if_5:template:text":"IF CONTENT 2","item-update:text_6":" hello ","item-update3:text":["updated: {1}, by: ","{{text.updated}}"],"item-update3:text_2":" xxx ","item-update3:dom-if_3:template:b":"IF","item-update3:dom-if_3:template:b_1":"CONTENT","item-update3:b_4":"abc","item-update3:dom-if_5:template:text":"IF CONTENT 2","item-update3:text_6":" hello ","item-update4:text":["updated: {1}, by: ","{{text.updated}}"],"item-update4:dom-repeat_1:template:text":[" {1} = {2} ","{{item.name}}","{{text.updated}}"],"item-update4:text_2":" xxx ","item-update4:dom-if_3:template:b":"IF CONTENT","item-update4:b_4":"abc","item-update4:dom-if_5:template:text":"IF CONTENT 2","item-update4:text_6":" hello ","paragraph:text":"A paragraph with ","paragraph:text_2":" is converted to ","paragraph:code_3":"","paragraph:text_4":". ","paragraph2:text":"A paragraph with deep ","paragraph2:text_2":" is ","paragraph2:b_3":"not","paragraph2:text_4":" converted to ","paragraph2:code_5":"","paragraph2:text_6":". ",authors:[{name:"Joe"},{name:"Alice"}],updated:"Jan 1st, 2016",parameters:["parameter 1","parameter 2"]},localDOM_complex_compound_binding=[{select:"[id=\"item-update\"] i18n-format","PolymerDom.childNodes.nonWS.0.textContent":text_complex_compound_binding["item-update:text"][0],"root.PolymerDom.effectiveChildNodes.nonWS.0.textContent":"updated: ","root.PolymerDom.effectiveChildNodes.nonWS.1.textContent.trim":text_complex_compound_binding.updated,"root.PolymerDom.effectiveChildNodes.nonWS.2.textContent.raw":", by: "},{select:"[id=\"item-update\"]","PolymerDom.childNodes.nonWS.1.textContent.trim":text_complex_compound_binding.authors[0].name,"PolymerDom.childNodes.nonWS.2.textContent.trim":text_complex_compound_binding.authors[1].name,"PolymerDom.childNodes.nonWS.3.tagName":"DOM-REPEAT","PolymerDom.childNodes.nonWS.4.textContent":text_complex_compound_binding["item-update:text_2"],"PolymerDom.childNodes.nonWS.5.textContent.trim":text_complex_compound_binding["item-update:dom-if_3:template:b"],"PolymerDom.childNodes.nonWS.6.tagName":"DOM-IF","PolymerDom.childNodes.nonWS.7.textContent.trim":text_complex_compound_binding["item-update:b_4"],"PolymerDom.childNodes.nonWS.8.textContent.trim":text_complex_compound_binding["item-update:dom-if_5:template:text"],"PolymerDom.childNodes.nonWS.9.tagName":"DOM-IF","PolymerDom.childNodes.nonWS.10.textContent":text_complex_compound_binding["item-update:text_6"]},{select:"[id=\"item-update2\"] i18n-format","PolymerDom.childNodes.nonWS.0.textContent":text_complex_compound_binding["item-update2:text"][0],"root.PolymerDom.effectiveChildNodes.nonWS.1.textContent.trim":text_complex_compound_binding.updated,"root.PolymerDom.effectiveChildNodes.nonWS.2.textContent.raw":", by: "},{select:"[id=\"item-update2\"]","PolymerDom.childNodes.nonWS.1.data.trim":text_complex_compound_binding.authors[0].name,"PolymerDom.childNodes.nonWS.2.data.trim":text_complex_compound_binding.authors[1].name,"PolymerDom.childNodes.nonWS.3.tagName":"DOM-REPEAT","PolymerDom.childNodes.nonWS.4.textContent":text_complex_compound_binding["item-update2:text_2"],"PolymerDom.childNodes.nonWS.5.childNodes.nonWS.0.textContent.trim":text_complex_compound_binding["item-update2:dom-if_3:template:span:b"],"PolymerDom.childNodes.nonWS.6.tagName":"DOM-IF","PolymerDom.childNodes.nonWS.7.textContent.trim":text_complex_compound_binding["item-update2:b_4"],"PolymerDom.childNodes.nonWS.8.data":text_complex_compound_binding["item-update2:dom-if_5:template:text"],"PolymerDom.childNodes.nonWS.9.tagName":"DOM-IF","PolymerDom.childNodes.nonWS.10.data":" hello "},{select:"[id=\"item-update3\"]","PolymerDom.childNodes.nonWS.1.data.trim":text_complex_compound_binding.authors[0].name,"PolymerDom.childNodes.nonWS.2.data.trim":text_complex_compound_binding.authors[1].name,"PolymerDom.childNodes.nonWS.3.tagName":"DOM-REPEAT","PolymerDom.childNodes.nonWS.4.textContent":text_complex_compound_binding["item-update3:text_2"],"PolymerDom.childNodes.nonWS.5.childNodes.nonWS.0.textContent.trim":text_complex_compound_binding["item-update3:dom-if_3:template:b"],"PolymerDom.childNodes.nonWS.6.childNodes.nonWS.0.textContent.trim":text_complex_compound_binding["item-update3:dom-if_3:template:b_1"],"PolymerDom.childNodes.nonWS.7.tagName":"DOM-IF","PolymerDom.childNodes.nonWS.8.textContent.trim":text_complex_compound_binding["item-update3:b_4"],"PolymerDom.childNodes.nonWS.9.data":text_complex_compound_binding["item-update3:dom-if_5:template:text"],"PolymerDom.childNodes.nonWS.10.tagName":"DOM-IF","PolymerDom.childNodes.nonWS.11.data":" hello "},{select:"[id=\"item-update4\"] i18n-format","PolymerDom.childNodes.nonWS.0.textContent":text_complex_compound_binding["item-update4:text"][0],"root.PolymerDom.effectiveChildNodes.nonWS.1.textContent.trim":text_complex_compound_binding.updated,"root.PolymerDom.effectiveChildNodes.nonWS.2.textContent.raw":", by: "},{select:"[id=\"item-update4\"] i18n-format +i18n-format","PolymerDom.childNodes.nonWS.0.textContent":text_complex_compound_binding["item-update4:dom-repeat_1:template:text"][0],"PolymerDom.childNodes.nonWS.1.textContent.trim":text_complex_compound_binding.authors[0].name,"PolymerDom.childNodes.nonWS.2.textContent.trim":text_complex_compound_binding.updated},{select:"[id=\"item-update4\"] i18n-format +i18n-format +i18n-format","PolymerDom.childNodes.nonWS.0.textContent":text_complex_compound_binding["item-update4:dom-repeat_1:template:text"][0],"PolymerDom.childNodes.nonWS.1.textContent.trim":text_complex_compound_binding.authors[1].name,"PolymerDom.childNodes.nonWS.2.textContent.trim":text_complex_compound_binding.updated},{select:"[id=\"item-update4\"] dom-repeat",tagName:["DOM-REPEAT"]},{select:"[id=\"item-update4\"] dom-if",tagName:["DOM-IF","DOM-IF"]},{select:"[id=\"item-update4\"] dom-repeat","nextTextSibling.data":text_complex_compound_binding["item-update4:text_2"]},{select:"[id=\"item-update4\"] b","PolymerDom.textContent":[text_complex_compound_binding["item-update4:dom-if_3:template:b"],text_complex_compound_binding["item-update4:b_4"]]},{select:"[id=\"item-update4\"]","PolymerDom.childNodes.nonWS.8.data":text_complex_compound_binding["item-update4:dom-if_5:template:text"],"PolymerDom.childNodes.nonWS.10.data":" hello "},{select:"[id=\"paragraph\"]","PolymerDom.childNodes.nonWS.0.textContent":text_complex_compound_binding["paragraph:text"],"PolymerDom.childNodes.nonWS.1.textContent.trim":text_complex_compound_binding.parameters[0],"PolymerDom.childNodes.nonWS.2.textContent.trim":text_complex_compound_binding.parameters[1]},{select:"[id=\"paragraph\"] code",tagName:"CODE",textContent:text_complex_compound_binding["paragraph:code_3"]},{select:"[id=\"paragraph2\"]","PolymerDom.childNodes.nonWS.0.data":text_complex_compound_binding["paragraph2:text"]},{select:"[id=\"paragraph2\"] span i",textContent:text_complex_compound_binding.parameters},{select:"[id=\"paragraph2\"] b",textContent:text_complex_compound_binding["paragraph2:b_3"],"previousTextSibling.data":text_complex_compound_binding["paragraph2:text_2"],"nextTextSibling.data":text_complex_compound_binding["paragraph2:text_4"]},{select:"[id=\"paragraph2\"] code",textContent:text_complex_compound_binding["paragraph2:code_5"],"nextTextSibling.data":text_complex_compound_binding["paragraph2:text_6"]}],text_advanced_binding={meta:{},model:{"aria-attributes":{title:"tooltip text","aria-label":"aria label text","aria-valuetext":"aria value text"}},"annotated-format":["{{tr(status,text.statusMessageFormats)}}","{{parameter}}","string parameter"],span_5:["{1} {2}","{{text.defaultValue}}","{{text.defaultValue}}"],statusMessages:{ok:"healthy status",busy:"busy status",error:"error status",default:"unknown status"},defaultValue:"default value",statusMessageFormats:{ok:"healthy status",busy:"busy status with {2}",error:"error status with {1} and {2}",default:"unknown status"},nodefault:{ok:"ok status"}},localDOM_advanced_binding_1=[{select:"[id=\"status\"]",textContent:"healthy status"},{select:"[id=\"default\"]","textContent.raw":"initial value"},{select:"[id=\"annotated-format\"]","root.PolymerDom.textContent":"healthy status"},{select:"[id=\"aria-attributes\"]","attributes.title.value.text":"tooltip text","attributes.aria-label.value.text":"aria label text","attributes.aria-valuetext.value.text":"aria value text","bindValue.raw":"initial value"}],localDOM_advanced_binding_2=[{select:"[id=\"status\"]",textContent:"busy status"},{select:"[id=\"default\"]",textContent:"default value"},{select:"[id=\"annotated-format\"]","root.PolymerDom.effectiveChildNodes.nonWS.0.textContent":"busy status with ","root.PolymerDom.effectiveChildNodes.nonWS.1.textContent":"string parameter"},{select:"[id=\"aria-attributes\"]","attributes.title.value.text":"tooltip text","attributes.aria-label.value.text":"aria label text","attributes.aria-valuetext.value.text":"aria value text","bindValue.raw":""}],localDOM_advanced_binding_3=[{select:"[id=\"status\"]",textContent:"error status"},{select:"[id=\"default\"]",textContent:"default value"},{select:"[id=\"annotated-format\"]","root.PolymerDom.effectiveChildNodes.nonWS.0.textContent":"error status with ","root.PolymerDom.effectiveChildNodes.nonWS.1.textContent.raw":"parameter text","root.PolymerDom.effectiveChildNodes.nonWS.2.textContent.raw":" and ","root.PolymerDom.effectiveChildNodes.nonWS.3.textContent":"string parameter"},{select:"[id=\"aria-attributes\"]","attributes.title.value.text":"tooltip text","attributes.aria-label.value.text":"aria label text","attributes.aria-valuetext.value.text":"aria value text","bindValue.raw":null}],localDOM_advanced_binding_4=[{select:"[id=\"status\"]",textContent:"unknown status"},{select:"[id=\"default\"]",textContent:"default value"},{select:"[id=\"annotated-format\"]","root.PolymerDom.effectiveChildNodes.nonWS.0.textContent":"unknown status"},{select:"[id=\"aria-attributes\"]","attributes.title.value.text":"tooltip text","attributes.aria-label.value.text":"aria label text","attributes.aria-valuetext.value.text":"aria value text","bindValue.raw":void 0}],suites=[s("empty element",null,{fixture:"empty-element-fixture",fixtureModel:void 0,assign:void 0,lang:lang1,effectiveLang:lang1,templateDefaultLang:lang1,observeHtmlLang:!0,model:{},localDOM:void 0,lightDOM:void 0}),s(lang2+" empty element","empty element",{fixture:"bound-empty-element-fixture",fixtureModel:{observeHtmlLang:!1,lang:lang1},assign:{lang:lang2},event:"lang-updated",lang:lang2,effectiveLang:lang2,observeHtmlLang:!1}),s("no template element","empty element",{fixture:"no-template-element-fixture"}),s("complex compound binding element","empty element",{setup:!0,fixture:"complex-compound-binding-element-fixture",fixtureModel:{observeHtmlLang:!1,lang:lang0},assign:{lang:lang1},event:"local-dom-ready",lang:lang1,effectiveLang:lang1,observeHtmlLang:!1,text:text_complex_compound_binding,localDOM:localDOM_complex_compound_binding}),s(lang2+" complex compound binding element","complex compound binding element",{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s("advanced binding element","empty element",{setup:!0,fixture:"advanced-binding-element-fixture",fixtureModel:{observeHtmlLang:!1,lang:lang0,status:"ok",value:"initial value",parameter:"parameter text"},assign:{lang:lang1},event:"local-dom-ready",lang:lang1,effectiveLang:lang1,observeHtmlLang:!1,text:text_advanced_binding,model:text_advanced_binding.model,localDOM:localDOM_advanced_binding_1}),s("advanced binding element 2","advanced binding element",{fixtureModel:{observeHtmlLang:!1,lang:lang0,status:"busy",value:"",parameter:"parameter text"},localDOM:localDOM_advanced_binding_2}),s("advanced binding element 3","advanced binding element",{fixtureModel:{observeHtmlLang:!1,lang:lang0,status:"error",value:null,parameter:"parameter text"},localDOM:localDOM_advanced_binding_3}),s("advanced binding element 4","advanced binding element",{fixtureModel:{observeHtmlLang:!1,lang:lang0,status:null,value:void 0,parameter:"parameter text"},localDOM:localDOM_advanced_binding_4}),s(lang2+" advanced binding element","advanced binding element",{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s(lang2+" advanced binding element 2","advanced binding element 2",{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s(lang2+" advanced binding element 3","advanced binding element 3",{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s(lang2+" advanced binding element 4","advanced binding element 4",{assign:{lang:lang2},lang:lang2,effectiveLang:lang2}),s(lang7+" fallback","advanced binding element 4",{timeout:6e4,assign:{lang:lang7},lang:lang0,effectiveLang:lang0}),s(lang8+" fallback",lang7+" fallback",{assign:{lang:lang8}}),s(lang9+" fallback",lang7+" fallback",{assign:{lang:lang9}}),s(lang10+" fallback",lang7+" fallback",{assign:{lang:lang10}})];suitesRunner(suites)});export{ironA11yAnnouncer as $ironA11yAnnouncer,ironMeta as $ironMeta,ironValidatableBehavior as $ironValidatableBehavior,arraySelector as $arraySelector,customStyle as $customStyle,domBind as $domBind,domIf as $domIf,domModule as $domModule,domRepeat as $domRepeat,_class as $class,legacyElementMixin as $legacyElementMixin,mutableDataBehavior as $mutableDataBehavior,polymerFn as $polymerFn,polymer_dom as $polymerDom,templatizerBehavior as $templatizerBehavior,dirMixin as $dirMixin,elementMixin as $elementMixin,gestureEventListeners as $gestureEventListeners,mutableData as $mutableData,propertiesChanged as $propertiesChanged,propertiesMixin as $propertiesMixin,propertyAccessors as $propertyAccessors,propertyEffects as $propertyEffects,templateStamp as $templateStamp,arraySplice as $arraySplice,async as $async,caseMap$1 as $caseMap,debounce as $debounce,flattenedNodesObserver as $flattenedNodesObserver,flush$2 as $flush,gestures$1 as $gestures,htmlTag as $htmlTag,mixin as $mixin,path as $path,renderStatus as $renderStatus,resolveUrl$1 as $resolveUrl,settings as $settings,styleGather as $styleGather,templatize$1 as $templatize,polymerElement as $polymerElement,polymerLegacy as $polymerLegacy,applyShimUtils as $applyShimUtils,applyShim as $applyShim$1,commonRegex as $commonRegex,commonUtils as $commonUtils,cssParse as $cssParse,customStyleInterface as $customStyleInterface$1,documentWait$1 as $documentWait,styleSettings as $styleSettings,styleUtil as $styleUtil,templateMap$1 as $templateMap,unscopedStyleHandler as $unscopedStyleHandler,deepcopy$1 as $deepcopy,plurals$1 as $plurals,IronA11yAnnouncer,IronMeta,IronValidatableBehaviorMeta,IronValidatableBehavior,ArraySelectorMixin,ArraySelector,CustomStyle,DomBind,DomIf,DomModule,DomRepeat,mixinBehaviors,Class,LegacyElementMixin,MutableDataBehavior,OptionalMutableDataBehavior,Polymer$1 as Polymer,flush$1 as flush,enqueueDebouncer as addDebouncer,matchesSelector,DomApi,EventApi,dom,Templatizer,DirMixin,version,ElementMixin,instanceCount,registrations,register,dumpRegistrations,updateStyles,GestureEventListeners,MutableData,OptionalMutableData,PropertiesChanged,PropertiesMixin,PropertyAccessors,PropertyEffects,TemplateStamp,calculateSplices,timeOut,animationFrame,idlePeriod,microTask,dashToCamelCase,camelToDashCase,Debouncer,FlattenedNodesObserver,enqueueDebouncer,flush$1,gestures,recognizers,deepTargetFind,addListener,removeListener,register$1,setTouchAction,prevent,resetMouseCanceller,findOriginalTarget,add,remove,html,htmlLiteral,dedupingMixin,isPath,root,isAncestor,isDescendant,translate$1 as translate,matches,normalize,split,get,set,isDeep,flush as flush$2,beforeNextRender,afterNextRender,resolveUrl,resolveCss,pathFromUrl,useShadow,useNativeCSSProperties,useNativeCustomElements,rootPath,setRootPath,sanitizeDOMValue,setSanitizeDOMValue,passiveTouchGestures,setPassiveTouchGestures,strictTemplatePolicy,setStrictTemplatePolicy,allowTemplateFromDomModule,setAllowTemplateFromDomModule,stylesFromModules,stylesFromModule,stylesFromTemplate,stylesFromModuleImports,cssFromModules,cssFromModule,cssFromTemplate,cssFromModuleImports,templatize,modelForElement,TemplateInstanceBase,html as html$1,version as version$1,PolymerElement,Polymer$1,html as html$2,Base,invalidate,invalidateTemplate,isValid,templateIsValid,isValidating,templateIsValidating,startValidating,startValidatingTemplate,elementsAreInvalid,ApplyShim as $applyShimDefault,VAR_ASSIGN,MIXIN_MATCH,VAR_CONSUMED,ANIMATION_MATCH,MEDIA_MATCH,IS_VAR,BRACKETED,HOST_PREFIX,HOST_SUFFIX,updateNativeProperties,getComputedStyleValue,detectMixin,StyleNode,parse,stringify,removeCustomPropAssignment,types,CustomStyleProvider,CustomStyleInterface as $customStyleInterfaceDefault,CustomStyleInterfaceInterface,documentWait as $documentWaitDefault,nativeShadow,cssBuild,nativeCssVariables,toCssText,rulesForStyle,isKeyframesSelector,forEachRule,applyCss,createScopeStyle,applyStylePlaceHolder,applyStyle,isTargetedBuild,findMatchingParen,processVariableAndFallback,setElementClassRaw,wrap,getIsExtends,gatherStyleText,splitSelectorList,getCssBuild,elementHasBuiltCss,getBuildComment,isOptimalCssBuild,templateMap as $templateMapDefault,scopingAttribute,processUnscopedStyle,isUnscopedStyle,deepcopy as $deepcopyDefault,plurals as $pluralsDefault}; \ No newline at end of file diff --git a/test/bundled/multiple-case-test-imports.js b/test/bundled/multiple-case-test-imports.js index bc14e210..8c5734e2 100644 --- a/test/bundled/multiple-case-test-imports.js +++ b/test/bundled/multiple-case-test-imports.js @@ -1,7302 +1,12 @@ -/** -@license -Copyright (c) 2017 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt -*/ /* eslint-disable no-unused-vars */ /** - * When using Closure Compiler, JSCompiler_renameProperty(property, object) is replaced by the munged name for object[property] - * We cannot alias this function, so we have to use a small shim that has the same behavior when not compiling. - * - * @param {string} prop Property name - * @param {?Object} obj Reference object - * @return {string} Potentially renamed property name - */window.JSCompiler_renameProperty=function(prop,obj){return prop;};/* eslint-enable */let CSS_URL_RX=/(url\()([^)]*)(\))/g;let ABS_URL=/(^\/)|(^#)|(^[\w-\d]*:)/;let workingURL;let resolveDoc;/** - * Resolves the given URL against the provided `baseUri'. - * - * Note that this function performs no resolution for URLs that start - * with `/` (absolute URLs) or `#` (hash identifiers). For general purpose - * URL resolution, use `window.URL`. - * - * @param {string} url Input URL to resolve - * @param {?string=} baseURI Base URI to resolve the URL against - * @return {string} resolved URL - */function resolveUrl(url,baseURI){if(url&&ABS_URL.test(url)){return url;}// Lazy feature detection. -if(workingURL===undefined){workingURL=false;try{const u=new URL('b','http://a');u.pathname='c%20d';workingURL=u.href==='http://a/c%20d';}catch(e){// silently fail -}}if(!baseURI){baseURI=document.baseURI||window.location.href;}if(workingURL){return new URL(url,baseURI).href;}// Fallback to creating an anchor into a disconnected document. -if(!resolveDoc){resolveDoc=document.implementation.createHTMLDocument('temp');resolveDoc.base=resolveDoc.createElement('base');resolveDoc.head.appendChild(resolveDoc.base);resolveDoc.anchor=resolveDoc.createElement('a');resolveDoc.body.appendChild(resolveDoc.anchor);}resolveDoc.base.href=baseURI;resolveDoc.anchor.href=url;return resolveDoc.anchor.href||url;}/** - * Resolves any relative URL's in the given CSS text against the provided - * `ownerDocument`'s `baseURI`. - * - * @param {string} cssText CSS text to process - * @param {string} baseURI Base URI to resolve the URL against - * @return {string} Processed CSS text with resolved URL's - */function resolveCss(cssText,baseURI){return cssText.replace(CSS_URL_RX,function(m,pre,url,post){return pre+'\''+resolveUrl(url.replace(/["']/g,''),baseURI)+'\''+post;});}/** - * Returns a path from a given `url`. The path includes the trailing - * `/` from the url. - * - * @param {string} url Input URL to transform - * @return {string} resolved path - */function pathFromUrl(url){return url.substring(0,url.lastIndexOf('/')+1);}var resolveUrl$1={resolveUrl:resolveUrl,resolveCss:resolveCss,pathFromUrl:pathFromUrl};const useShadow=!window.ShadyDOM;const useNativeCSSProperties=Boolean(!window.ShadyCSS||window.ShadyCSS.nativeCss);const useNativeCustomElements=!window.customElements.polyfillWrapFlushCallback;/** - * Globally settable property that is automatically assigned to - * `ElementMixin` instances, useful for binding in templates to - * make URL's relative to an application's root. Defaults to the main - * document URL, but can be overridden by users. It may be useful to set - * `rootPath` to provide a stable application mount path when - * using client side routing. - */let rootPath=undefined||pathFromUrl(document.baseURI||window.location.href);/** - * Sets the global rootPath property used by `ElementMixin` and - * available via `rootPath`. - * - * @param {string} path The new root path - * @return {void} - */const setRootPath=function(path){rootPath=path;};/** - * A global callback used to sanitize any value before inserting it into the DOM. - * The callback signature is: - * - * function sanitizeDOMValue(value, name, type, node) { ... } - * - * Where: - * - * `value` is the value to sanitize. - * `name` is the name of an attribute or property (for example, href). - * `type` indicates where the value is being inserted: one of property, attribute, or text. - * `node` is the node where the value is being inserted. - * - * @type {(function(*,string,string,Node):*)|undefined} - */let sanitizeDOMValue=window.Polymer&&window.Polymer.sanitizeDOMValue||undefined;/** - * Sets the global sanitizeDOMValue available via this module's exported - * `sanitizeDOMValue` variable. - * - * @param {(function(*,string,string,Node):*)|undefined} newSanitizeDOMValue the global sanitizeDOMValue callback - * @return {void} - */const setSanitizeDOMValue=function(newSanitizeDOMValue){sanitizeDOMValue=newSanitizeDOMValue;};/** - * Globally settable property to make Polymer Gestures use passive TouchEvent listeners when recognizing gestures. - * When set to `true`, gestures made from touch will not be able to prevent scrolling, allowing for smoother - * scrolling performance. - * Defaults to `false` for backwards compatibility. - */let passiveTouchGestures=false;/** - * Sets `passiveTouchGestures` globally for all elements using Polymer Gestures. - * - * @param {boolean} usePassive enable or disable passive touch gestures globally - * @return {void} - */const setPassiveTouchGestures=function(usePassive){passiveTouchGestures=usePassive;};/** - * Setting to ensure Polymer template evaluation only occurs based on tempates - * defined in trusted script. When true, `` re-registration is - * disallowed, `` is disabled, and ``/`` - * templates will only evaluate in the context of a trusted element template. - */let strictTemplatePolicy=false;/** - * Sets `strictTemplatePolicy` globally for all elements - * - * @param {boolean} useStrictPolicy enable or disable strict template policy - * globally - * @return {void} - */const setStrictTemplatePolicy=function(useStrictPolicy){strictTemplatePolicy=useStrictPolicy;};/** - * Setting to enable dom-module lookup from Polymer.Element. By default, - * templates must be defined in script using the `static get template()` - * getter and the `html` tag function. To enable legacy loading of templates - * via dom-module, set this flag to true. - */let allowTemplateFromDomModule=false;/** - * Sets `lookupTemplateFromDomModule` globally for all elements - * - * @param {boolean} allowDomModule enable or disable template lookup - * globally - * @return {void} - */const setAllowTemplateFromDomModule=function(allowDomModule){allowTemplateFromDomModule=allowDomModule;};var settings={useShadow:useShadow,useNativeCSSProperties:useNativeCSSProperties,useNativeCustomElements:useNativeCustomElements,get rootPath(){return rootPath;},setRootPath:setRootPath,get sanitizeDOMValue(){return sanitizeDOMValue;},setSanitizeDOMValue:setSanitizeDOMValue,get passiveTouchGestures(){return passiveTouchGestures;},setPassiveTouchGestures:setPassiveTouchGestures,get strictTemplatePolicy(){return strictTemplatePolicy;},setStrictTemplatePolicy:setStrictTemplatePolicy,get allowTemplateFromDomModule(){return allowTemplateFromDomModule;},setAllowTemplateFromDomModule:setAllowTemplateFromDomModule};let dedupeId=0;/** - * @constructor - * @extends {Function} - * @private - */function MixinFunction(){}/** @type {(WeakMap | undefined)} */MixinFunction.prototype.__mixinApplications;/** @type {(Object | undefined)} */MixinFunction.prototype.__mixinSet;/* eslint-disable valid-jsdoc */ /** - * Wraps an ES6 class expression mixin such that the mixin is only applied - * if it has not already been applied its base argument. Also memoizes mixin - * applications. - * - * @template T - * @param {T} mixin ES6 class expression mixin to wrap - * @return {T} - * @suppress {invalidCasts} - */const dedupingMixin=function(mixin){let mixinApplications=/** @type {!MixinFunction} */mixin.__mixinApplications;if(!mixinApplications){mixinApplications=new WeakMap();/** @type {!MixinFunction} */mixin.__mixinApplications=mixinApplications;}// maintain a unique id for each mixin -let mixinDedupeId=dedupeId++;function dedupingMixin(base){let baseSet=/** @type {!MixinFunction} */base.__mixinSet;if(baseSet&&baseSet[mixinDedupeId]){return base;}let map=mixinApplications;let extended=map.get(base);if(!extended){extended=/** @type {!Function} */mixin(base);map.set(base,extended);}// copy inherited mixin set from the extended class, or the base class -// NOTE: we avoid use of Set here because some browser (IE11) -// cannot extend a base Set via the constructor. -let mixinSet=Object.create(/** @type {!MixinFunction} */extended.__mixinSet||baseSet||null);mixinSet[mixinDedupeId]=true;/** @type {!MixinFunction} */extended.__mixinSet=mixinSet;return extended;}return dedupingMixin;};/* eslint-enable valid-jsdoc */var mixin={dedupingMixin:dedupingMixin};let modules={};let lcModules={};/** - * Sets a dom-module into the global registry by id. - * - * @param {string} id dom-module id - * @param {DomModule} module dom-module instance - * @return {void} - */function setModule(id,module){// store id separate from lowercased id so that -// in all cases mixedCase id will stored distinctly -// and lowercase version is a fallback -modules[id]=lcModules[id.toLowerCase()]=module;}/** - * Retrieves a dom-module from the global registry by id. - * - * @param {string} id dom-module id - * @return {DomModule!} dom-module instance - */function findModule(id){return modules[id]||lcModules[id.toLowerCase()];}function styleOutsideTemplateCheck(inst){if(inst.querySelector('style')){console.warn('dom-module %s has style outside template',inst.id);}}/** - * The `dom-module` element registers the dom it contains to the name given - * by the module's id attribute. It provides a unified database of dom - * accessible via its static `import` API. - * - * A key use case of `dom-module` is for providing custom element `