forked from ogaoga/json-visual-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-actions.js
67 lines (64 loc) · 1.44 KB
/
test-actions.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
62
63
64
65
66
67
import expect from 'expect';
import {describe, it} from 'mocha'
import {updateText, setText, clearText, copyText, pasteSample, setAutoFormat, resetValid,
openTextarea, closeTextarea, toggleTextarea} from '../src/actions/index'
import {Actions} from '../src/Constants.js'
let params = [
{
title: 'updateText',
actual: updateText('abc').type,
expected: Actions.UpdateText
},
{
title: 'setText',
actual: setText('abc').type,
expected: Actions.SetText
},
{
title: 'clearText',
actual: clearText().type,
expected: Actions.ClearText
},
{
title: 'copyText',
actual: copyText().type,
expected: Actions.CopyText
},
{
title: 'pasteSample',
actual: pasteSample().type,
expected: Actions.PasteSample
},
{
title: 'setAutoFormat',
actual: setAutoFormat(true).type,
expected: Actions.SetAutoFormat
},
{
title: 'resetValid',
actual: resetValid().type,
expected: Actions.ResetValid
},
{
title: 'openTextarea',
actual: openTextarea().type,
expected: Actions.OpenTextarea
},
{
title: 'closeTextarea',
actual: closeTextarea().type,
expected: Actions.CloseTextarea
},
{
title: 'toggleTextarea',
actual: toggleTextarea().type,
expected: Actions.ToggleTextarea
}
];
describe('actions', () => {
params.forEach((param) => {
it(param.title, () => {
expect(param.actual).toEqual(param.expected);
});
});
});