-
Notifications
You must be signed in to change notification settings - Fork 116
Expand file tree
/
Copy pathbehavior.test.ts
More file actions
48 lines (45 loc) · 909 Bytes
/
behavior.test.ts
File metadata and controls
48 lines (45 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { expectType, expectError } from 'tsd'
expectType<string>(Behavior({}))
Behavior({
behaviors: [],
properties: {
myProperty: {
type: String,
value: '',
},
myProperty2: String,
min: {
type: Number,
value: 0,
},
max: {
type: Number,
value: 0,
observer(newVal, oldVal) {
expectType<any>(newVal)
expectType<any>(oldVal.toExponential())
},
},
},
data: {
text: 'init data',
array: [{ msg: '1' }, { msg: '2' }],
logs: [] as string[],
},
attached() {},
methods: {
myBehaviorMethod() {
expectError(this.created())
expectType<string>(this.data.text)
expectType<string>(this.properties.text)
expectType<number>(this.data.max)
expectType<string>(this.properties.myProperty2)
},
},
})
Behavior({
attached() {},
pageLifetimes: {
show() {},
},
})