Skip to content

Commit

Permalink
Ensure path notifications from templatized instances don't throw. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Jan 10, 2018
1 parent bde5898 commit a9f71bd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/utils/templatize.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,15 @@
}
return model;
}

/**
* Stub of HTMLElement's `dispatchEvent`, so that effects that may
* dispatch events safely no-op.
*
* @param event {Event} Event to dispatch
*/
dispatchEvent(event) {
}
}

/** @type {!DataTemplate} */
Expand Down
11 changes: 11 additions & 0 deletions test/unit/templatize.html
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,17 @@
assert.equal(div.textContent, 'text');
});

test('notifies path data changes', function() {
const template = document.getElementById('standalone').cloneNode(true);
const Template = Polymer.Templatize.templatize(template);
const inst = new Template();
const div = inst.root.firstElementChild;
inst.setProperties({prop: {foo: true}});
assert.equal(div.prop.foo, true);
inst.set('prop.foo', false);
assert.equal(div.prop.foo, false);
});

});

</script>
Expand Down

0 comments on commit a9f71bd

Please sign in to comment.