Skip to content

Commit 3a149ab

Browse files
committed
tests
1 parent 2169158 commit 3a149ab

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ var Shared = (function () {
150150
});
151151
}
152152
break;
153-
default: {
154-
break;
155-
}
156153
}
157154
};
158155
return Shared;

src/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,6 @@ class Shared implements ICommon {
222222
});
223223
}
224224
break;
225-
default: {
226-
break;
227-
}
228225
}
229226
}
230227
}

test/index.spec.tsx

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import {Controlled, UnControlled} from '../src';
88
Enzyme.configure({adapter: new Adapter()});
99

1010
global.console = {
11-
warn: jest.fn()
12-
}
11+
warn: jest.fn(),
12+
log: console.log
13+
};
1314

1415
describe('[temporary] deprecation notice', () => {
1516

@@ -327,4 +328,36 @@ describe('Props', () => {
327328
}}/>
328329
);
329330
});
331+
332+
it('[Controlled]: autoFocus', () => {
333+
let wrapper = Enzyme.mount(
334+
<Controlled
335+
value='foo'
336+
autoFocus={true}
337+
cursor={{
338+
line: 0,
339+
ch: 3
340+
}}/>
341+
);
342+
343+
let editor = wrapper.instance().editor;
344+
345+
expect(editor.state.focused).toBe(true)
346+
});
347+
348+
it('[UnControlled]: autoFocus', () => {
349+
let wrapper = Enzyme.mount(
350+
<UnControlled
351+
value='foo'
352+
autoFocus={true}
353+
cursor={{
354+
line: 0,
355+
ch: 3
356+
}}/>
357+
);
358+
359+
let editor = wrapper.instance().editor;
360+
361+
expect(editor.state.focused).toBe(true)
362+
});
330363
});

0 commit comments

Comments
 (0)