/
radio-group.gemini.js
61 lines (54 loc) · 2.11 KB
/
radio-group.gemini.js
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
56
57
58
59
60
61
var gemini = require('gemini');
gemini.suite('radio-group', function(root) {
root.setUrl('desktop.tests/radio-group/gemini/gemini.html');
[
//'default',
//'button-normal-m',
//'button-normal-l',
//'button-normal-m-icon',
//'button-normal-l-icon',
'normal-l'
//'normal-m',
//'line-normal-m',
//'line-normal-l'
]
.forEach(function(test) {
var radioItemSelector = '.' + test,
radioItemSelectorEnabled = radioItemSelector + '-enabled',
radioItemSelectorDisabled = radioItemSelector + '-disabled',
captureArea,
control;
if(!!~test.indexOf('button')) {
captureArea = radioItemSelectorEnabled + ' .button';
control = ' .radio';
} else {
captureArea = radioItemSelectorEnabled + ' .radio__box';
control = ' .radio__control';
}
gemini.suite(test + '-enabled', function(suite) {
suite
.setCaptureElements(radioItemSelectorEnabled, captureArea)
.before(function(actions, find) {
this.radioItem = find(radioItemSelectorEnabled + control);
})
.capture('plain')
.capture('hovered', function(actions) {
actions.mouseMove(this.radioItem);
})
.capture('down', function(actions) {
actions.mouseDown(this.radioItem);
})
.capture('up', function(actions) {
actions.mouseUp(this.radioItem);
})
.capture('focus', function(actions) {
actions.sendKeys(this.radioItem, 'focus-hard');
})
});
gemini.suite(test + '-disabled', function(suite) {
suite
.setCaptureElements(radioItemSelectorDisabled)
.capture('plain');
});
});
});