Skip to content

Commit 16614d9

Browse files
committed
Add first factory
1 parent 38007a3 commit 16614d9

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {Factory} from 'rosie';
2+
3+
export const position = new Factory().attrs({
4+
line: 0,
5+
ch: 0,
6+
});
7+
8+
export const change = new Factory()
9+
.attr('from', () => position.build())
10+
.attr('to', () => position.build())
11+
.attrs({
12+
text: 'c',
13+
removed: '',
14+
origin: '+input',
15+
});

src/components/__tests__/CodeMirrorEditor.test.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import TestRenderer, {act} from 'react-test-renderer';
77

88
import CodeMirrorEditor from '../CodeMirrorEditor';
99

10+
import {change as changeFactory} from '@factories/packages/codemirror';
11+
1012
const DEFAULT_PROPS = {
1113
errors: [],
1214
language: 'html',
@@ -122,11 +124,11 @@ describe('codemirror editor', () => {
122124

123125
const newSource = DEFAULT_PROPS.source.replace('<html>', '<html>d');
124126
editor.getValue.mockReturnValueOnce(newSource);
125-
handleChanges(null, [{origin: '+input'}]);
127+
handleChanges(null, [changeFactory.build({origin: '+input'})]);
126128
expect(DEFAULT_PROPS.onInput).toHaveBeenLastCalledWith(newSource);
127129

128130
DEFAULT_PROPS.onInput.mockClear();
129-
handleChanges(null, [{origin: 'setValue'}]);
131+
handleChanges(null, [changeFactory.build({origin: 'setValue'})]);
130132
expect(DEFAULT_PROPS.onInput).not.toHaveBeenCalled();
131133
});
132134
});

0 commit comments

Comments
 (0)