@@ -10,6 +10,9 @@ describe('GitIdentityView', function() {
10
10
< GitIdentityView
11
11
usernameBuffer = { new TextBuffer ( ) }
12
12
emailBuffer = { new TextBuffer ( ) }
13
+ canWriteLocal = { true }
14
+ setLocal = { ( ) => { } }
15
+ setGlobal = { ( ) => { } }
13
16
close = { ( ) => { } }
14
17
{ ...override }
15
18
/>
@@ -30,27 +33,37 @@ describe('GitIdentityView', function() {
30
33
assert . strictEqual ( getEditor ( 'email address' ) . prop ( 'buffer' ) , emailBuffer ) ;
31
34
} ) ;
32
35
33
- it ( 'disables the "Continue" button if the name is blank' , function ( ) {
34
- const usernameBuffer = new TextBuffer ( ) ;
35
- const wrapper = mount ( buildApp ( { usernameBuffer} ) ) ;
36
+ it ( 'disables the local repo button when canWriteLocal is false' , function ( ) {
37
+ const wrapper = mount ( buildApp ( { canWriteLocal : false } ) ) ;
36
38
37
- assert . isTrue ( wrapper . find ( '.btn' ) . prop ( 'disabled' ) ) ;
39
+ assert . isTrue ( wrapper . find ( '.btn' ) . filterWhere ( each => / t h i s r e p o s i t o r y / . test ( each . text ( ) ) ) . prop ( 'disabled' ) ) ;
38
40
} ) ;
39
41
40
- it ( 'disables the "Continue" button if the email is blank' , function ( ) {
41
- const emailBuffer = new TextBuffer ( ) ;
42
- const wrapper = mount ( buildApp ( { emailBuffer} ) ) ;
42
+ it ( 'triggers a callback when "Use for this repository" is clicked' , function ( ) {
43
+ const setLocal = sinon . spy ( ) ;
44
+ const wrapper = mount ( buildApp ( { setLocal} ) ) ;
45
+
46
+ wrapper . find ( '.btn' ) . filterWhere ( each => / t h i s r e p o s i t o r y / . test ( each . text ( ) ) ) . simulate ( 'click' ) ;
47
+
48
+ assert . isTrue ( setLocal . called ) ;
49
+ } ) ;
50
+
51
+ it ( 'triggers a callback when "Use for all repositories" is clicked' , function ( ) {
52
+ const setGlobal = sinon . spy ( ) ;
53
+ const wrapper = mount ( buildApp ( { setGlobal} ) ) ;
54
+
55
+ wrapper . find ( '.btn' ) . filterWhere ( each => / a l l r e p o s i t o r i e s / . test ( each . text ( ) ) ) . simulate ( 'click' ) ;
43
56
44
- assert . isTrue ( wrapper . find ( '.btn' ) . prop ( 'disabled' ) ) ;
57
+ assert . isTrue ( setGlobal . called ) ;
45
58
} ) ;
46
59
47
- it ( 'triggers a callback when "Continue " is clicked' , function ( ) {
60
+ it ( 'triggers a callback when "Cancel " is clicked' , function ( ) {
48
61
const usernameBuffer = new TextBuffer ( { text : 'Me' } ) ;
49
62
const emailBuffer = new TextBuffer ( { text :
'[email protected] ' } ) ;
50
63
const close = sinon . spy ( ) ;
51
64
const wrapper = mount ( buildApp ( { usernameBuffer, emailBuffer, close} ) ) ;
52
65
53
- wrapper . find ( '.btn' ) . simulate ( 'click' ) ;
66
+ wrapper . find ( '.btn' ) . filterWhere ( each => / C a n c e l / . test ( each . text ( ) ) ) . simulate ( 'click' ) ;
54
67
55
68
assert . isTrue ( close . called ) ;
56
69
} ) ;
0 commit comments