Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test for fallback _readyClients. Fixes #4547 #4548

Merged
merged 2 commits into from
Apr 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/mixins/property-effects.html
Original file line number Diff line number Diff line change
Expand Up @@ -1507,14 +1507,14 @@
}

/**
* Overrides PropertyAccessor
* Overrides `PropertyAccessors` to call `_readyClients` callback
* if it was not called as a result of flushing properties.
*
* @override
*/
ready() {
let dataPending = this.__dataPending;
super.ready();
if (!dataPending) {
if (!this.__dataClientsInitialized) {
this._readyClients();
}
}
Expand Down
25 changes: 25 additions & 0 deletions test/unit/configure.html
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,29 @@
};
</script>

<dom-module id="x-config-lazy-nodefaults">
<template>
<div>x-config-lazy-nodefaults</div>
</template>
<script>
window.XConfigLazyNoDefaults = {
is: 'x-config-lazy-nodefaults',
properties: {
prop: {
observer: 'propChanged'
}
},
created: function() {
this.propChanged = sinon.spy();
}
};
</script>
</dom-module>

<dom-module id="x-config-lazy-host">
<template>
<x-config-lazy id="lazy" prop="{{foo}}" read-only-prop="{{foo}}" had-attr-prop="attrValue" bound-no-effect-prop="{{foo}}"></x-config-lazy>
<x-config-lazy-nodefaults prop="[[foo]]"></x-config-lazy-nodefaults>
</template>
<script>
HTMLImports.whenReady(function() {
Expand Down Expand Up @@ -491,6 +511,11 @@
var el = document.createElement('x-config-lazy-host');
document.body.appendChild(el);
Polymer(window.XConfigLazy);
// The purpose of this test is to test lazy upgrading an element that
// has a property pre-bound to it (that has an accessor) but that has
// no defaults for it (stresses a prior bug in ready() code that called
// _attachDom twice, which throws in Safari's native SD
Polymer(window.XConfigLazyNoDefaults);
assert.equal(el.$.lazy.noEffectProp, 1);
assert.equal(el.$.lazy.defaultUsesNoEffectProp, 2);
assert.equal(el.$.lazy.boundNoEffectProp, 'foo');
Expand Down