@@ -62,39 +62,38 @@ describe('CommitView', function() {
6262
6363 it ( 'displays the remaining characters limit based on which line is being edited' , function ( ) {
6464 const wrapper = mount ( app ) ;
65- const remaining = wrapper . find ( '.github-CommitView-remaining-characters' ) ;
66- assert . strictEqual ( remaining . text ( ) , '72' ) ;
65+ assert . strictEqual ( wrapper . find ( '.github-CommitView-remaining-characters' ) . text ( ) , '72' ) ;
6766
6867 wrapper . setProps ( { message : 'abcde fghij' } ) ;
69- assert . strictEqual ( remaining . text ( ) , '61' ) ;
70- assert . isFalse ( remaining . hasClass ( 'is-error' ) ) ;
71- assert . isFalse ( remaining . hasClass ( 'is-warning' ) ) ;
68+ assert . strictEqual ( wrapper . find ( '.github-CommitView- remaining-characters' ) . text ( ) , '61' ) ;
69+ assert . isFalse ( wrapper . find ( '.github-CommitView- remaining-characters' ) . hasClass ( 'is-error' ) ) ;
70+ assert . isFalse ( wrapper . find ( '.github-CommitView- remaining-characters' ) . hasClass ( 'is-warning' ) ) ;
7271
7372 wrapper . setProps ( { message : '\nklmno' } ) ;
74- assert . strictEqual ( remaining . text ( ) , '∞' ) ;
75- assert . isFalse ( remaining . hasClass ( 'is-error' ) ) ;
76- assert . isFalse ( remaining . hasClass ( 'is-warning' ) ) ;
73+ assert . strictEqual ( wrapper . find ( '.github-CommitView- remaining-characters' ) . text ( ) , '∞' ) ;
74+ assert . isFalse ( wrapper . find ( '.github-CommitView- remaining-characters' ) . hasClass ( 'is-error' ) ) ;
75+ assert . isFalse ( wrapper . find ( '.github-CommitView- remaining-characters' ) . hasClass ( 'is-warning' ) ) ;
7776
7877 wrapper . setProps ( { message : 'abcde\npqrst' } ) ;
79- assert . strictEqual ( remaining . text ( ) , '∞' ) ;
80- assert . isFalse ( remaining . hasClass ( 'is-error' ) ) ;
81- assert . isFalse ( remaining . hasClass ( 'is-warning' ) ) ;
78+ assert . strictEqual ( wrapper . find ( '.github-CommitView- remaining-characters' ) . text ( ) , '∞' ) ;
79+ assert . isFalse ( wrapper . find ( '.github-CommitView- remaining-characters' ) . hasClass ( 'is-error' ) ) ;
80+ assert . isFalse ( wrapper . find ( '.github-CommitView- remaining-characters' ) . hasClass ( 'is-warning' ) ) ;
8281
83- wrapper . find ( 'atom-text-editor' ) . getNode ( ) . getModel ( ) . setCursorBufferPosition ( [ 0 , 3 ] ) ;
82+ wrapper . find ( 'atom-text-editor' ) . getDOMNode ( ) . getModel ( ) . setCursorBufferPosition ( [ 0 , 3 ] ) ;
8483 wrapper . update ( ) ;
85- assert . strictEqual ( remaining . text ( ) , '67' ) ;
86- assert . isFalse ( remaining . hasClass ( 'is-error' ) ) ;
87- assert . isFalse ( remaining . hasClass ( 'is-warning' ) ) ;
84+ assert . strictEqual ( wrapper . find ( '.github-CommitView- remaining-characters' ) . text ( ) , '67' ) ;
85+ assert . isFalse ( wrapper . find ( '.github-CommitView- remaining-characters' ) . hasClass ( 'is-error' ) ) ;
86+ assert . isFalse ( wrapper . find ( '.github-CommitView- remaining-characters' ) . hasClass ( 'is-warning' ) ) ;
8887
8988 wrapper . setProps ( { stagedChangesExist : true , maximumCharacterLimit : 50 } ) ;
90- assert . strictEqual ( remaining . text ( ) , '45' ) ;
91- assert . isFalse ( remaining . hasClass ( 'is-error' ) ) ;
92- assert . isFalse ( remaining . hasClass ( 'is-warning' ) ) ;
89+ assert . strictEqual ( wrapper . find ( '.github-CommitView- remaining-characters' ) . text ( ) , '45' ) ;
90+ assert . isFalse ( wrapper . find ( '.github-CommitView- remaining-characters' ) . hasClass ( 'is-error' ) ) ;
91+ assert . isFalse ( wrapper . find ( '.github-CommitView- remaining-characters' ) . hasClass ( 'is-warning' ) ) ;
9392
9493 wrapper . setProps ( { message : 'a' . repeat ( 41 ) } ) ;
95- assert . strictEqual ( remaining . text ( ) , '9' ) ;
96- assert . isFalse ( remaining . hasClass ( 'is-error' ) ) ;
97- assert . isTrue ( remaining . hasClass ( 'is-warning' ) ) ;
94+ assert . strictEqual ( wrapper . find ( '.github-CommitView- remaining-characters' ) . text ( ) , '9' ) ;
95+ assert . isFalse ( wrapper . find ( '.github-CommitView- remaining-characters' ) . hasClass ( 'is-error' ) ) ;
96+ assert . isTrue ( wrapper . find ( '.github-CommitView- remaining-characters' ) . hasClass ( 'is-warning' ) ) ;
9897
9998 wrapper . setProps ( { message : 'a' . repeat ( 58 ) } ) ;
10099 assert . strictEqual ( wrapper . find ( '.github-CommitView-remaining-characters' ) . text ( ) , '-8' ) ;
@@ -103,7 +102,7 @@ describe('CommitView', function() {
103102 } ) ;
104103
105104 describe ( 'the commit button' , function ( ) {
106- let wrapper , commitButton ;
105+ let wrapper ;
107106
108107 beforeEach ( async function ( ) {
109108 const workdirPath = await cloneRepository ( 'three-files' ) ;
@@ -116,53 +115,51 @@ describe('CommitView', function() {
116115 message : 'something' ,
117116 } ) ;
118117 wrapper = mount ( app ) ;
119-
120- commitButton = wrapper . find ( '.github-CommitView-commit' ) ;
121118 } ) ;
122119
123120 it ( 'is disabled when no changes are staged' , function ( ) {
124121 wrapper . setProps ( { stagedChangesExist : false } ) ;
125- assert . isTrue ( commitButton . prop ( 'disabled' ) ) ;
122+ assert . isTrue ( wrapper . find ( '.github-CommitView-commit' ) . prop ( 'disabled' ) ) ;
126123
127124 wrapper . setProps ( { stagedChangesExist : true } ) ;
128- assert . isFalse ( commitButton . prop ( 'disabled' ) ) ;
125+ assert . isFalse ( wrapper . find ( '.github-CommitView-commit' ) . prop ( 'disabled' ) ) ;
129126 } ) ;
130127
131128 it ( 'is disabled when there are merge conflicts' , function ( ) {
132129 wrapper . setProps ( { mergeConflictsExist : true } ) ;
133- assert . isTrue ( commitButton . prop ( 'disabled' ) ) ;
130+ assert . isTrue ( wrapper . find ( '.github-CommitView-commit' ) . prop ( 'disabled' ) ) ;
134131
135132 wrapper . setProps ( { mergeConflictsExist : false } ) ;
136- assert . isFalse ( commitButton . prop ( 'disabled' ) ) ;
133+ assert . isFalse ( wrapper . find ( '.github-CommitView-commit' ) . prop ( 'disabled' ) ) ;
137134 } ) ;
138135
139136 it ( 'is disabled when the commit message is empty' , function ( ) {
140137 wrapper . setProps ( { message : '' } ) ;
141- assert . isTrue ( commitButton . prop ( 'disabled' ) ) ;
138+ assert . isTrue ( wrapper . find ( '.github-CommitView-commit' ) . prop ( 'disabled' ) ) ;
142139
143140 wrapper . setProps ( { message : 'Not empty' } ) ;
144- assert . isFalse ( commitButton . prop ( 'disabled' ) ) ;
141+ assert . isFalse ( wrapper . find ( '.github-CommitView-commit' ) . prop ( 'disabled' ) ) ;
145142 } ) ;
146143
147144 it ( 'displays the current branch name' , function ( ) {
148145 const currentBranch = new Branch ( 'aw-do-the-stuff' ) ;
149146 wrapper . setProps ( { currentBranch} ) ;
150- assert . strictEqual ( commitButton . text ( ) , 'Commit to aw-do-the-stuff' ) ;
147+ assert . strictEqual ( wrapper . find ( '.github-CommitView-commit' ) . text ( ) , 'Commit to aw-do-the-stuff' ) ;
151148 } ) ;
152149
153150 it ( 'indicates when a commit will be detached' , function ( ) {
154151 const currentBranch = Branch . createDetached ( 'master~3' ) ;
155152 wrapper . setProps ( { currentBranch} ) ;
156- assert . strictEqual ( commitButton . text ( ) , 'Create detached commit' ) ;
153+ assert . strictEqual ( wrapper . find ( '.github-CommitView-commit' ) . text ( ) , 'Create detached commit' ) ;
157154 } ) ;
158155
159156 it ( 'displays a progress message while committing' , function ( ) {
160157 wrapper . setState ( { showWorking : true } ) ;
161- assert . strictEqual ( commitButton . text ( ) , 'Working...' ) ;
158+ assert . strictEqual ( wrapper . find ( '.github-CommitView-commit' ) . text ( ) , 'Working...' ) ;
162159 } ) ;
163160
164161 it ( 'falls back to "commit" with no current branch' , function ( ) {
165- assert . strictEqual ( commitButton . text ( ) , 'Commit' ) ;
162+ assert . strictEqual ( wrapper . find ( '.github-CommitView-commit' ) . text ( ) , 'Commit' ) ;
166163 } ) ;
167164 } ) ;
168165
@@ -177,16 +174,15 @@ describe('CommitView', function() {
177174 app = React . cloneElement ( app , { stagedChangesExist : true , prepareToCommit, commit, message : 'Something' } ) ;
178175 wrapper = mount ( app ) ;
179176
180- editorElement = wrapper . find ( 'atom-text-editor' ) . getNode ( ) ;
177+ editorElement = wrapper . find ( 'atom-text-editor' ) . getDOMNode ( ) ;
181178 sinon . spy ( editorElement , 'focus' ) ;
182179 editor = editorElement . getModel ( ) ;
183180
184181 // Perform an extra render to ensure the editor text is reflected in the commit button enablement.
185182 // The controller accomplishes this by re-rendering on Repository update.
186- wrapper . update ( ) ;
183+ wrapper . setProps ( { } ) ;
187184
188185 commitButton = wrapper . find ( '.github-CommitView-commit' ) ;
189-
190186 workspaceElement = atomEnv . views . getView ( atomEnv . workspace ) ;
191187 } ) ;
192188
@@ -196,6 +192,7 @@ describe('CommitView', function() {
196192 } ) ;
197193
198194 it ( 'calls props.commit(message) when the commit button is clicked' , async function ( ) {
195+ wrapper . update ( ) ;
199196 commitButton . simulate ( 'click' ) ;
200197
201198 await assert . async . isTrue ( commit . calledWith ( 'Something' ) ) ;
0 commit comments