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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « sky/tests/framework/templates-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- 1 <!--
2 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 --> 5 -->
6 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" /> 6 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" />
7 7
8 <sky-element name="test-element"> 8 <sky-element name="test-element" attributes="size:number, checked:boolean,name:s tring">
9 <template> 9 <template>
10 <div id="inside" on-test-event="handleEvent" attr="{{ value }}">{{ value }}</d iv> 10 <div id="inside" on-test-event="handleEvent" attr="{{ value }}">{{ value }}</d iv>
11 </template> 11 </template>
12 <script> 12 <script>
13 module.exports = class extends SkyElement { 13 module.exports = class extends SkyElement {
14 created() { 14 created() {
15 this.lastEvent = null; 15 this.lastEvent = null;
16 this.value = 10; 16 this.value = 10;
17 this.shadowRootReadyCount = 0; 17 this.shadowRootReadyCount = 0;
18 this.changes = [];
18 } 19 }
19 handleEvent(event) { 20 handleEvent(event) {
20 this.lastEvent = event; 21 this.lastEvent = event;
21 } 22 }
22 shadowRootReady() { 23 shadowRootReady() {
23 this.shadowRootReadyCount++; 24 this.shadowRootReadyCount++;
24 } 25 }
26 sizeChanged(oldValue, newValue) {
27 this.recordAttributeChange('size', oldValue, newValue);
28 }
29 checkedChanged(oldValue, newValue) {
30 this.recordAttributeChange('checked', oldValue, newValue);
31 }
32 nameChanged(oldValue, newValue) {
33 this.recordAttributeChange('name', oldValue, newValue);
34 }
35 recordAttributeChange(name, oldValue, newValue) {
36 this.changes.push({
37 name: name,
38 newValue: newValue,
39 oldValue: oldValue,
40 });
41 }
25 }.register(); 42 }.register();
26 </script> 43 </script>
27 </sky-element> 44 </sky-element>
OLDNEW
« 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