Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(689)

Unified Diff: sky/tests/resources/test-element.sky

Issue 836923002: Automate reflected properties in SkyElement. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: moar single quotes Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/tests/framework/templates-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tests/resources/test-element.sky
diff --git a/sky/tests/resources/test-element.sky b/sky/tests/resources/test-element.sky
index 193b9e2067404c8b62c2c777e4e982c977693a01..a178ed912c37cc62f82568750d59168236b3d795 100644
--- a/sky/tests/resources/test-element.sky
+++ b/sky/tests/resources/test-element.sky
@@ -5,7 +5,7 @@
-->
<import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" />
-<sky-element name="test-element">
+<sky-element name="test-element" attributes="size:number, checked:boolean,name:string">
<template>
<div id="inside" on-test-event="handleEvent" attr="{{ value }}">{{ value }}</div>
</template>
@@ -15,6 +15,7 @@ module.exports = class extends SkyElement {
this.lastEvent = null;
this.value = 10;
this.shadowRootReadyCount = 0;
+ this.changes = [];
}
handleEvent(event) {
this.lastEvent = event;
@@ -22,6 +23,22 @@ module.exports = class extends SkyElement {
shadowRootReady() {
this.shadowRootReadyCount++;
}
+ sizeChanged(oldValue, newValue) {
+ this.recordAttributeChange('size', oldValue, newValue);
+ }
+ checkedChanged(oldValue, newValue) {
+ this.recordAttributeChange('checked', oldValue, newValue);
+ }
+ nameChanged(oldValue, newValue) {
+ this.recordAttributeChange('name', oldValue, newValue);
+ }
+ recordAttributeChange(name, oldValue, newValue) {
+ this.changes.push({
+ name: name,
+ newValue: newValue,
+ oldValue: oldValue,
+ });
+ }
}.register();
</script>
</sky-element>
« no previous file with comments | « sky/tests/framework/templates-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698