Skip to content

Instantly share code, notes, and snippets.

@esprehn
Created June 20, 2014 01:04
Show Gist options
  • Save esprehn/1f80d17709b34eb66187 to your computer and use it in GitHub Desktop.
Save esprehn/1f80d17709b34eb66187 to your computer and use it in GitHub Desktop.
<polymer-test name="my-widget-tests">
<template>
<my-widget object="{{ object }}"></my-widget>
</template>
<script>
PolymerTest("my-widget-tests", {
setup: function(data) {
// Setup data binding for each test.
data.object = {someValue: 2};
},
"should load data": function(widget) {
assert.equal(widget.computedProperty, 2);
assert.equal(widget.shadowRoot.firstChild.textContent, "My value is 2");
}
"should handle dynamic changes": function(widget, data, done) {
data.object = {someValue: 5};
endOfMicrotask(function() {
assert.equal(widget.computedProperty, 5);
assert.equal(widget.shadowRoot.firstChild.textContent, "My value is 5");
done();
});
}
})
</script>
</polymer-test>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment