From d53323dc07e26737482b1ca34b3ba34f480e1ff6 Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Mon, 14 Mar 2016 19:28:07 -0700 Subject: [PATCH] Add `forceRegister` flag to force an element to fully register when `Polymer` is called. Normally, some work is deferred until the first element instance is created. Add lazy registration tests. --- src/lib/base.html | 3 + test/runner.html | 3 +- test/unit/lazy-register.html | 107 +++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 test/unit/lazy-register.html diff --git a/src/lib/base.html b/src/lib/base.html index 5c8ecc3aa0..b2feaf5797 100644 --- a/src/lib/base.html +++ b/src/lib/base.html @@ -28,6 +28,9 @@ this._desugarBehaviors(); // abstract this._doBehavior('beforeRegister'); // abstract this._registerFeatures(); // abstract + if (this.forceRegister) { + this.ensureRegistered(); + } }, createdCallback: function() { diff --git a/test/runner.html b/test/runner.html index c81bcdef26..53410cee75 100644 --- a/test/runner.html +++ b/test/runner.html @@ -71,7 +71,8 @@ 'unit/dom-bind.html', 'unit/dom-bind-yield.html', 'unit/script-after-import-in-head.html', - 'unit/globals.html' + 'unit/globals.html', + 'unit/lazy-register.html' ]; if (document.body.createShadowRoot) { diff --git a/test/unit/lazy-register.html b/test/unit/lazy-register.html new file mode 100644 index 0000000000..bae08acb11 --- /dev/null +++ b/test/unit/lazy-register.html @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +