_WidgetTests.ts
41 lines
| 863 B
| video/mp2t
|
TypeScriptLexer
cin
|
r2 | import * as _WidgetBase from "dijit/_WidgetBase"; | ||
import { watch } from "./traits"; | ||||
cin
|
r1 | |||
interface ScheduleWidgetAttrs { | ||||
data: string[]; | ||||
} | ||||
cin
|
r2 | interface ScheduleWidgetEvents { | ||
"scheduled": Event & { | ||||
detail: { | ||||
startDate: Date, | ||||
endDate: Date | ||||
} | ||||
}; | ||||
} | ||||
cin
|
r1 | |||
cin
|
r2 | declare class ScheduleWidget extends _WidgetBase<ScheduleWidgetAttrs, ScheduleWidgetEvents> { | ||
cin
|
r1 | data: string[]; | ||
} | ||||
const w = new ScheduleWidget({title: "Year schedule", data: ["a", "b"] }); | ||||
cin
|
r2 | w.get("data"); | ||
w.watch((p, o, n) => [p,o,n]); | ||||
w.watch("data", (p, o, n) => [p,o,n]); | ||||
watch(w, "title", v => String(v) ); | ||||
watch(w, "data", v => String(v) ); | ||||
w.emit("scheduled", { detail: { startDate: new Date(), endDate: new Date()} }); | ||||
w.emit("click", {} ); | ||||
w.emit("click", {} ); | ||||
w.emit("some-extra-event", {}); | ||||
w.on("click", e => e); | ||||
w.on("some-extra-event", e => e); | ||||