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
49
50
51
52
53
54
55
|
import t from 'tap';
import {linkAndBindWikiData} from '#test-lib';
import thingConstructors from '#things';
const {
Flash,
FlashAct,
Thing,
} = thingConstructors;
function stubFlash(directory = 'foo') {
const flash = new Flash();
flash.directory = directory;
return flash;
}
function stubFlashAct(flashes, directory = 'bar') {
const flashAct = new FlashAct();
flashAct.directory = directory;
flashAct.flashes = flashes.map(flash => Thing.getReference(flash));
return flashAct;
}
t.test(`Flash.color`, t => {
t.plan(4);
const flash = stubFlash();
const flashAct = stubFlashAct([flash]);
const {XXX_decacheWikiData} = linkAndBindWikiData({
flashData: [flash],
flashActData: [flashAct],
});
t.equal(flash.color, null,
`color #1: defaults to null`);
flashAct.color = '#abcdef';
XXX_decacheWikiData();
t.equal(flash.color, '#abcdef',
`color #2: inherits from flash act`);
flash.color = '#123456';
t.equal(flash.color, '#123456',
`color #3: is own value`);
t.throws(() => { flash.color = '#aeiouw'; },
{cause: TypeError},
`color #4: must be set to valid color`);
});
|