forked from atom/github
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbranch-menu-view.test.js
48 lines (39 loc) · 1.46 KB
/
branch-menu-view.test.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
import React from 'react';
import {shallow} from 'enzyme';
import BranchMenuView from '../../lib/views/branch-menu-view';
import Branch, {nullBranch} from '../../lib/models/branch';
import BranchSet from '../../lib/models/branch-set';
import {cloneRepository, buildRepository} from '../helpers';
describe('BranchMenuView', function() {
let atomEnv, repository;
beforeEach(async function() {
atomEnv = global.buildAtomEnvironment();
repository = await buildRepository(await cloneRepository());
});
afterEach(function() {
atomEnv.destroy();
});
function buildApp(overrides = {}) {
const currentBranch = new Branch('master', nullBranch, nullBranch, true);
const branches = new BranchSet([currentBranch]);
return (
<BranchMenuView
workspace={atomEnv.workspace}
commandRegistry={atomEnv.commands}
notificationManager={atomEnv.notifications}
repository={repository}
branches={branches}
currentBranch={currentBranch}
checkout={() => {}}
{...overrides}
/>
);
}
it('cancels new branch creation', function() {
const wrapper = shallow(buildApp());
wrapper.find('.github-BranchMenuView-button').simulate('click');
wrapper.find('Command[command="core:cancel"]').prop('callback')();
assert.isTrue(wrapper.find('.github-BranchMenuView-editor').hasClass('hidden'));
assert.isFalse(wrapper.find('.github-BranchMenuView-select').hasClass('hidden'));
});
});