@@ -43,7 +43,7 @@ suite('Workbench untitled text editors', () => {
4343 ( accessor . untitledTextEditorService as UntitledTextEditorService ) . dispose ( ) ;
4444 } ) ;
4545
46- test ( 'Untitled Text Editor Service ' , async ( done ) => {
46+ test ( 'basics ' , async ( done ) => {
4747 const service = accessor . untitledTextEditorService ;
4848 const workingCopyService = accessor . workingCopyService ;
4949
@@ -108,7 +108,7 @@ suite('Workbench untitled text editors', () => {
108108 input2 . dispose ( ) ;
109109 } ) ;
110110
111- test ( 'Untitled with associated resource is dirty' , ( ) => {
111+ test ( 'associated resource is dirty' , ( ) => {
112112 const service = accessor . untitledTextEditorService ;
113113 const file = URI . file ( join ( 'C:\\' , '/foo/file.txt' ) ) ;
114114 const untitled = service . create ( { associatedResource : file } ) ;
@@ -119,7 +119,7 @@ suite('Workbench untitled text editors', () => {
119119 untitled . dispose ( ) ;
120120 } ) ;
121121
122- test ( 'Untitled no longer dirty when content gets empty (not with associated resource)' , async ( ) => {
122+ test ( 'no longer dirty when content gets empty (not with associated resource)' , async ( ) => {
123123 const service = accessor . untitledTextEditorService ;
124124 const workingCopyService = accessor . workingCopyService ;
125125 const input = service . create ( ) ;
@@ -136,7 +136,7 @@ suite('Workbench untitled text editors', () => {
136136 model . dispose ( ) ;
137137 } ) ;
138138
139- test ( 'Untitled via create options' , async ( ) => {
139+ test ( 'via create options' , async ( ) => {
140140 const service = accessor . untitledTextEditorService ;
141141
142142 const model1 = await service . create ( ) . resolve ( ) ;
@@ -168,15 +168,15 @@ suite('Workbench untitled text editors', () => {
168168 input . dispose ( ) ;
169169 } ) ;
170170
171- test ( 'Untitled suggest name' , function ( ) {
171+ test ( 'suggest name' , function ( ) {
172172 const service = accessor . untitledTextEditorService ;
173173 const input = service . create ( ) ;
174174
175175 assert . ok ( input . suggestFileName ( ) . length > 0 ) ;
176176 input . dispose ( ) ;
177177 } ) ;
178178
179- test ( 'Untitled with associated path remains dirty when content gets empty' , async ( ) => {
179+ test ( 'associated path remains dirty when content gets empty' , async ( ) => {
180180 const service = accessor . untitledTextEditorService ;
181181 const file = URI . file ( join ( 'C:\\' , '/foo/file.txt' ) ) ;
182182 const input = service . create ( { associatedResource : file } ) ;
@@ -191,7 +191,7 @@ suite('Workbench untitled text editors', () => {
191191 model . dispose ( ) ;
192192 } ) ;
193193
194- test ( 'Untitled with initial content is dirty' , async ( ) => {
194+ test ( 'initial content is dirty' , async ( ) => {
195195 const service = accessor . untitledTextEditorService ;
196196 const workingCopyService = accessor . workingCopyService ;
197197
@@ -214,7 +214,7 @@ suite('Workbench untitled text editors', () => {
214214 model . dispose ( ) ;
215215 } ) ;
216216
217- test ( 'Untitled created with files.defaultLanguage setting' , ( ) => {
217+ test ( 'created with files.defaultLanguage setting' , ( ) => {
218218 const defaultLanguage = 'javascript' ;
219219 const config = accessor . testConfigurationService ;
220220 config . setUserConfiguration ( 'files' , { 'defaultLanguage' : defaultLanguage } ) ;
@@ -229,7 +229,7 @@ suite('Workbench untitled text editors', () => {
229229 input . dispose ( ) ;
230230 } ) ;
231231
232- test ( 'Untitled created with files.defaultLanguage setting (${activeEditorLanguage})' , ( ) => {
232+ test ( 'created with files.defaultLanguage setting (${activeEditorLanguage})' , ( ) => {
233233 const config = accessor . testConfigurationService ;
234234 config . setUserConfiguration ( 'files' , { 'defaultLanguage' : '${activeEditorLanguage}' } ) ;
235235
@@ -246,7 +246,7 @@ suite('Workbench untitled text editors', () => {
246246 input . dispose ( ) ;
247247 } ) ;
248248
249- test ( 'Untitled created with mode overrides files.defaultLanguage setting' , ( ) => {
249+ test ( 'created with mode overrides files.defaultLanguage setting' , ( ) => {
250250 const mode = 'typescript' ;
251251 const defaultLanguage = 'javascript' ;
252252 const config = accessor . testConfigurationService ;
@@ -262,7 +262,7 @@ suite('Workbench untitled text editors', () => {
262262 input . dispose ( ) ;
263263 } ) ;
264264
265- test ( 'Untitled can change mode afterwards' , async ( ) => {
265+ test ( 'can change mode afterwards' , async ( ) => {
266266 const mode = 'untitled-input-test' ;
267267
268268 ModesRegistry . registerLanguage ( {
@@ -285,7 +285,7 @@ suite('Workbench untitled text editors', () => {
285285 model . dispose ( ) ;
286286 } ) ;
287287
288- test ( 'encoding change event ' , async ( ) => {
288+ test ( 'service#onDidChangeEncoding ' , async ( ) => {
289289 const service = accessor . untitledTextEditorService ;
290290 const input = service . create ( ) ;
291291
@@ -296,15 +296,52 @@ suite('Workbench untitled text editors', () => {
296296 assert . equal ( r . toString ( ) , input . getResource ( ) . toString ( ) ) ;
297297 } ) ;
298298
299- // dirty
299+ // encoding
300300 const model = await input . resolve ( ) ;
301301 model . setEncoding ( 'utf16' ) ;
302302 assert . equal ( counter , 1 ) ;
303303 input . dispose ( ) ;
304304 model . dispose ( ) ;
305305 } ) ;
306306
307- test ( 'onDidChangeContent event' , async function ( ) {
307+ test ( 'service#onDidChangeLabel' , async ( ) => {
308+ const service = accessor . untitledTextEditorService ;
309+ const input = service . create ( ) ;
310+
311+ let counter = 0 ;
312+
313+ service . onDidChangeLabel ( r => {
314+ counter ++ ;
315+ assert . equal ( r . toString ( ) , input . getResource ( ) . toString ( ) ) ;
316+ } ) ;
317+
318+ // label
319+ const model = await input . resolve ( ) ;
320+ model . textEditorModel . setValue ( 'Foo Bar' ) ;
321+ assert . equal ( counter , 1 ) ;
322+ input . dispose ( ) ;
323+ model . dispose ( ) ;
324+ } ) ;
325+
326+ test ( 'service#onDidDisposeModel' , async ( ) => {
327+ const service = accessor . untitledTextEditorService ;
328+ const input = service . create ( ) ;
329+
330+ let counter = 0 ;
331+
332+ service . onDidDisposeModel ( r => {
333+ counter ++ ;
334+ assert . equal ( r . toString ( ) , input . getResource ( ) . toString ( ) ) ;
335+ } ) ;
336+
337+ const model = await input . resolve ( ) ;
338+ assert . equal ( counter , 0 ) ;
339+ input . dispose ( ) ;
340+ assert . equal ( counter , 1 ) ;
341+ model . dispose ( ) ;
342+ } ) ;
343+
344+ test ( 'model#onDidChangeContent' , async function ( ) {
308345 const service = accessor . untitledTextEditorService ;
309346 const input = service . create ( ) ;
310347
@@ -330,7 +367,7 @@ suite('Workbench untitled text editors', () => {
330367 model . dispose ( ) ;
331368 } ) ;
332369
333- test ( 'onDidChangeFirstLine event and input name' , async function ( ) {
370+ test ( 'model# onDidChangeFirstLine and input name' , async function ( ) {
334371 const service = accessor . untitledTextEditorService ;
335372 const input = service . create ( ) ;
336373
@@ -386,7 +423,7 @@ suite('Workbench untitled text editors', () => {
386423 model . dispose ( ) ;
387424 } ) ;
388425
389- test ( 'onDidChangeDirty event ' , async function ( ) {
426+ test ( 'model# onDidChangeDirty' , async function ( ) {
390427 const service = accessor . untitledTextEditorService ;
391428 const input = service . create ( ) ;
392429
@@ -405,22 +442,4 @@ suite('Workbench untitled text editors', () => {
405442 input . dispose ( ) ;
406443 model . dispose ( ) ;
407444 } ) ;
408-
409- test ( 'onDidDisposeModel event' , async ( ) => {
410- const service = accessor . untitledTextEditorService ;
411- const input = service . create ( ) ;
412-
413- let counter = 0 ;
414-
415- service . onDidDisposeModel ( r => {
416- counter ++ ;
417- assert . equal ( r . toString ( ) , input . getResource ( ) . toString ( ) ) ;
418- } ) ;
419-
420- const model = await input . resolve ( ) ;
421- assert . equal ( counter , 0 ) ;
422- input . dispose ( ) ;
423- assert . equal ( counter , 1 ) ;
424- model . dispose ( ) ;
425- } ) ;
426445} ) ;
0 commit comments