flutter_flutter/tests/resources/test-element.sky
Adam Barth c51ca09e15 Move sky-box,-button,-checkbox,-radio out of their directories
Instead of having a separate directory for every Sky element, we should just
put them in the general framework directory. Once the framework is more
complicated, we'll probably want to organize it a bit better, but for now there
aren't enough files to justify having so many directories.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/874303003
2015-01-26 09:20:25 -08:00

50 lines
1.4 KiB
Plaintext

<!--
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-->
<import src="/sky/framework/sky-checkbox.sky" />
<import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" />
<sky-element
name="test-element"
attributes="size:number, checked:boolean,name:string"
on-host-event="handleEvent">
<template>
<div id="inside" on-test-event="handleEvent" lang="{{ value }}">{{ value }}</div>
<sky-checkbox id="checkbox" checked="{{ checked }}" />
</template>
<script>
module.exports = class extends SkyElement {
created() {
this.lastEvent = null;
this.value = 10;
this.shadowRootReadyCount = 0;
this.changes = [];
}
handleEvent(event) {
this.lastEvent = event;
}
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>