@@ -41,7 +41,7 @@ suite('Files - TextFileEditorModel', () => {
4141 } ) ;
4242
4343 test ( 'Load does not trigger save' , function ( done ) {
44- const m1 = instantiationService . createInstance ( TextFileEditorModel , toResource ( '/path/index.txt' ) , 'utf8' ) ;
44+ const model = instantiationService . createInstance ( TextFileEditorModel , toResource ( '/path/index.txt' ) , 'utf8' ) ;
4545
4646 accessor . eventService . addListener2 ( 'files:internalFileChanged' , ( ) => {
4747 assert . ok ( false ) ;
@@ -55,26 +55,26 @@ suite('Files - TextFileEditorModel', () => {
5555 assert . ok ( false ) ;
5656 } ) ;
5757
58- m1 . load ( ) . then ( ( ) => {
59- assert . ok ( m1 . isResolved ( ) ) ;
58+ model . load ( ) . then ( ( ) => {
59+ assert . ok ( model . isResolved ( ) ) ;
6060
61- m1 . dispose ( ) ;
61+ model . dispose ( ) ;
6262
6363 done ( ) ;
6464 } ) ;
6565 } ) ;
6666
6767 test ( 'Load returns dirty model as long as model is dirty' , function ( done ) {
68- const m1 = instantiationService . createInstance ( TextFileEditorModel , toResource ( '/path/index_async.txt' ) , 'utf8' ) ;
68+ const model = instantiationService . createInstance ( TextFileEditorModel , toResource ( '/path/index_async.txt' ) , 'utf8' ) ;
6969
70- m1 . load ( ) . then ( ( ) => {
71- m1 . textEditorModel . setValue ( 'foo' ) ;
70+ model . load ( ) . then ( ( ) => {
71+ model . textEditorModel . setValue ( 'foo' ) ;
7272
73- assert . ok ( m1 . isDirty ( ) ) ;
74- m1 . load ( ) . then ( ( ) => {
75- assert . ok ( m1 . isDirty ( ) ) ;
73+ assert . ok ( model . isDirty ( ) ) ;
74+ model . load ( ) . then ( ( ) => {
75+ assert . ok ( model . isDirty ( ) ) ;
7676
77- m1 . dispose ( ) ;
77+ model . dispose ( ) ;
7878
7979 done ( ) ;
8080 } ) ;
@@ -88,43 +88,43 @@ suite('Files - TextFileEditorModel', () => {
8888 eventCounter ++ ;
8989 } ) ;
9090
91- const m1 = instantiationService . createInstance ( TextFileEditorModel , toResource ( '/path/index_async.txt' ) , 'utf8' ) ;
91+ const model = instantiationService . createInstance ( TextFileEditorModel , toResource ( '/path/index_async.txt' ) , 'utf8' ) ;
9292
93- m1 . load ( ) . then ( ( ) => {
94- m1 . textEditorModel . setValue ( 'foo' ) ;
93+ model . load ( ) . then ( ( ) => {
94+ model . textEditorModel . setValue ( 'foo' ) ;
9595
96- assert . ok ( m1 . isDirty ( ) ) ;
96+ assert . ok ( model . isDirty ( ) ) ;
9797
98- m1 . revert ( ) . then ( ( ) => {
99- assert . ok ( ! m1 . isDirty ( ) ) ;
100- assert . equal ( m1 . textEditorModel . getValue ( ) , 'Hello Html' ) ;
98+ model . revert ( ) . then ( ( ) => {
99+ assert . ok ( ! model . isDirty ( ) ) ;
100+ assert . equal ( model . textEditorModel . getValue ( ) , 'Hello Html' ) ;
101101 assert . equal ( eventCounter , 1 ) ;
102102
103- m1 . dispose ( ) ;
103+ model . dispose ( ) ;
104104
105105 done ( ) ;
106106 } ) ;
107107 } ) ;
108108 } ) ;
109109
110110 test ( 'Conflict Resolution Mode' , function ( done ) {
111- const m1 = instantiationService . createInstance ( TextFileEditorModel , toResource ( '/path/index_async.txt' ) , 'utf8' ) ;
111+ const model = instantiationService . createInstance ( TextFileEditorModel , toResource ( '/path/index_async.txt' ) , 'utf8' ) ;
112112
113- m1 . load ( ) . then ( ( ) => {
114- m1 . setConflictResolutionMode ( ) ;
115- m1 . textEditorModel . setValue ( 'foo' ) ;
113+ model . load ( ) . then ( ( ) => {
114+ model . setConflictResolutionMode ( ) ;
115+ model . textEditorModel . setValue ( 'foo' ) ;
116116
117- assert . ok ( m1 . isDirty ( ) ) ;
118- assert . ok ( m1 . isInConflictResolutionMode ( ) ) ;
117+ assert . ok ( model . isDirty ( ) ) ;
118+ assert . ok ( model . isInConflictResolutionMode ( ) ) ;
119119
120- m1 . revert ( ) . then ( ( ) => {
121- m1 . textEditorModel . setValue ( 'bar' ) ;
122- assert . ok ( m1 . isDirty ( ) ) ;
120+ model . revert ( ) . then ( ( ) => {
121+ model . textEditorModel . setValue ( 'bar' ) ;
122+ assert . ok ( model . isDirty ( ) ) ;
123123
124- return m1 . save ( ) . then ( ( ) => {
125- assert . ok ( ! m1 . isDirty ( ) ) ;
124+ return model . save ( ) . then ( ( ) => {
125+ assert . ok ( ! model . isDirty ( ) ) ;
126126
127- m1 . dispose ( ) ;
127+ model . dispose ( ) ;
128128
129129 done ( ) ;
130130 } ) ;
@@ -134,10 +134,10 @@ suite('Files - TextFileEditorModel', () => {
134134
135135 test ( 'Auto Save triggered when model changes' , function ( done ) {
136136 let eventCounter = 0 ;
137- const m1 = instantiationService . createInstance ( TextFileEditorModel , toResource ( '/path/index.txt' ) , 'utf8' ) ;
137+ const model = instantiationService . createInstance ( TextFileEditorModel , toResource ( '/path/index.txt' ) , 'utf8' ) ;
138138
139- ( < any > m1 ) . autoSaveAfterMillies = 10 ;
140- ( < any > m1 ) . autoSaveAfterMilliesEnabled = true ;
139+ ( < any > model ) . autoSaveAfterMillies = 10 ;
140+ ( < any > model ) . autoSaveAfterMilliesEnabled = true ;
141141
142142 accessor . eventService . addListener2 ( EventType . FILE_DIRTY , ( ) => {
143143 eventCounter ++ ;
@@ -147,51 +147,51 @@ suite('Files - TextFileEditorModel', () => {
147147 eventCounter ++ ;
148148 } ) ;
149149
150- m1 . load ( ) . then ( ( ) => {
151- m1 . textEditorModel . setValue ( 'foo' ) ;
150+ model . load ( ) . then ( ( ) => {
151+ model . textEditorModel . setValue ( 'foo' ) ;
152152
153153 return TPromise . timeout ( 50 ) . then ( ( ) => {
154- assert . ok ( ! m1 . isDirty ( ) ) ;
154+ assert . ok ( ! model . isDirty ( ) ) ;
155155 assert . equal ( eventCounter , 2 ) ;
156156
157- m1 . dispose ( ) ;
157+ model . dispose ( ) ;
158158
159159 done ( ) ;
160160 } ) ;
161161 } ) ;
162162 } ) ;
163163
164164 test ( 'save() and isDirty() - proper with check for mtimes' , function ( done ) {
165- const c1 = instantiationService . createInstance ( FileEditorInput , toResource ( '/path/index_async2.txt' ) , 'text/plain' , 'utf8' ) ;
166- const c2 = instantiationService . createInstance ( FileEditorInput , toResource ( '/path/index_async.txt' ) , 'text/plain' , 'utf8' ) ;
165+ const input1 = instantiationService . createInstance ( FileEditorInput , toResource ( '/path/index_async2.txt' ) , 'text/plain' , 'utf8' ) ;
166+ const input2 = instantiationService . createInstance ( FileEditorInput , toResource ( '/path/index_async.txt' ) , 'text/plain' , 'utf8' ) ;
167167
168- c1 . resolve ( ) . then ( ( m1 : TextFileEditorModel ) => {
169- c2 . resolve ( ) . then ( ( m2 : TextFileEditorModel ) => {
170- m1 . textEditorModel . setValue ( 'foo' ) ;
168+ input1 . resolve ( ) . then ( ( model1 : TextFileEditorModel ) => {
169+ input2 . resolve ( ) . then ( ( model2 : TextFileEditorModel ) => {
170+ model1 . textEditorModel . setValue ( 'foo' ) ;
171171
172- const m1Mtime = m1 . getLastModifiedTime ( ) ;
173- const m2Mtime = m2 . getLastModifiedTime ( ) ;
172+ const m1Mtime = model1 . getLastModifiedTime ( ) ;
173+ const m2Mtime = model2 . getLastModifiedTime ( ) ;
174174 assert . ok ( m1Mtime > 0 ) ;
175175 assert . ok ( m2Mtime > 0 ) ;
176176
177177 assert . ok ( accessor . textFileService . isDirty ( ) ) ;
178178 assert . ok ( accessor . textFileService . isDirty ( toResource ( '/path/index_async2.txt' ) ) ) ;
179179 assert . ok ( ! accessor . textFileService . isDirty ( toResource ( '/path/index_async.txt' ) ) ) ;
180180
181- m2 . textEditorModel . setValue ( 'foo' ) ;
181+ model2 . textEditorModel . setValue ( 'foo' ) ;
182182 assert . ok ( accessor . textFileService . isDirty ( toResource ( '/path/index_async.txt' ) ) ) ;
183183
184184 return TPromise . timeout ( 10 ) . then ( ( ) => {
185185 accessor . textFileService . saveAll ( ) . then ( ( ) => {
186186 assert . ok ( ! accessor . textFileService . isDirty ( toResource ( '/path/index_async.txt' ) ) ) ;
187187 assert . ok ( ! accessor . textFileService . isDirty ( toResource ( '/path/index_async2.txt' ) ) ) ;
188- assert . ok ( m1 . getLastModifiedTime ( ) > m1Mtime ) ;
189- assert . ok ( m2 . getLastModifiedTime ( ) > m2Mtime ) ;
190- assert . ok ( m1 . getLastSaveAttemptTime ( ) > m1Mtime ) ;
191- assert . ok ( m2 . getLastSaveAttemptTime ( ) > m2Mtime ) ;
188+ assert . ok ( model1 . getLastModifiedTime ( ) > m1Mtime ) ;
189+ assert . ok ( model2 . getLastModifiedTime ( ) > m2Mtime ) ;
190+ assert . ok ( model1 . getLastSaveAttemptTime ( ) > m1Mtime ) ;
191+ assert . ok ( model2 . getLastSaveAttemptTime ( ) > m2Mtime ) ;
192192
193- m1 . dispose ( ) ;
194- m2 . dispose ( ) ;
193+ model1 . dispose ( ) ;
194+ model2 . dispose ( ) ;
195195
196196 done ( ) ;
197197 } ) ;
@@ -202,26 +202,26 @@ suite('Files - TextFileEditorModel', () => {
202202
203203 test ( 'Save Participant' , function ( done ) {
204204 let eventCounter = 0 ;
205- const m1 = instantiationService . createInstance ( TextFileEditorModel , toResource ( '/path/index_async.txt' ) , 'utf8' ) ;
205+ const model = instantiationService . createInstance ( TextFileEditorModel , toResource ( '/path/index_async.txt' ) , 'utf8' ) ;
206206
207207 accessor . eventService . addListener2 ( EventType . FILE_SAVED , ( e ) => {
208- assert . equal ( m1 . getValue ( ) , 'bar' ) ;
209- assert . ok ( ! m1 . isDirty ( ) ) ;
208+ assert . equal ( model . getValue ( ) , 'bar' ) ;
209+ assert . ok ( ! model . isDirty ( ) ) ;
210210 eventCounter ++ ;
211211 } ) ;
212212
213213 accessor . eventService . addListener2 ( EventType . FILE_SAVING , ( e ) => {
214- assert . ok ( m1 . isDirty ( ) ) ;
215- m1 . textEditorModel . setValue ( 'bar' ) ;
216- assert . ok ( m1 . isDirty ( ) ) ;
214+ assert . ok ( model . isDirty ( ) ) ;
215+ model . textEditorModel . setValue ( 'bar' ) ;
216+ assert . ok ( model . isDirty ( ) ) ;
217217 eventCounter ++ ;
218218 } ) ;
219219
220- m1 . load ( ) . then ( ( ) => {
221- m1 . textEditorModel . setValue ( 'foo' ) ;
220+ model . load ( ) . then ( ( ) => {
221+ model . textEditorModel . setValue ( 'foo' ) ;
222222
223- m1 . save ( ) . then ( ( ) => {
224- m1 . dispose ( ) ;
223+ model . save ( ) . then ( ( ) => {
224+ model . dispose ( ) ;
225225
226226 assert . equal ( eventCounter , 2 ) ;
227227
0 commit comments