@@ -11,7 +11,6 @@ import { IUntitledTextEditorService, UntitledTextEditorService } from 'vs/workbe
1111import { workbenchInstantiationService , TestServiceAccessor } from 'vs/workbench/test/browser/workbenchTestServices' ;
1212import { snapshotToString } from 'vs/workbench/services/textfile/common/textfiles' ;
1313import { ModesRegistry , PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry' ;
14- import { IWorkingCopy } from 'vs/workbench/services/workingCopy/common/workingCopyService' ;
1514import { IIdentifiedSingleEditOperation } from 'vs/editor/common/model' ;
1615import { Range } from 'vs/editor/common/core/range' ;
1716import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput' ;
@@ -120,9 +119,13 @@ suite('Untitled text editors', () => {
120119 test ( 'associated resource is dirty' , async ( ) => {
121120 const service = accessor . untitledTextEditorService ;
122121 const file = URI . file ( join ( 'C:\\' , '/foo/file.txt' ) ) ;
123- const untitled = await service . resolve ( { associatedResource : file } ) ;
124122
125- assert . ok ( untitled . hasAssociatedFilePath ) ;
123+ const untitled = instantiationService . createInstance ( UntitledTextEditorInput , service . create ( { associatedResource : file } ) ) ;
124+ assert . ok ( untitled . isDirty ( ) ) ;
125+
126+ const model = await untitled . resolve ( ) ;
127+
128+ assert . ok ( model . hasAssociatedFilePath ) ;
126129 assert . equal ( untitled . isDirty ( ) , true ) ;
127130
128131 untitled . dispose ( ) ;
@@ -197,20 +200,14 @@ suite('Untitled text editors', () => {
197200 const workingCopyService = accessor . workingCopyService ;
198201
199202 const untitled = instantiationService . createInstance ( UntitledTextEditorInput , service . create ( { initialValue : 'Hello World' } ) ) ;
200-
201- let onDidChangeDirty : IWorkingCopy | undefined = undefined ;
202- const listener = workingCopyService . onDidChangeDirty ( copy => {
203- onDidChangeDirty = copy ;
204- } ) ;
203+ assert . ok ( untitled . isDirty ( ) ) ;
205204
206205 // dirty
207206 const model = await untitled . resolve ( ) ;
208207 assert . ok ( model . isDirty ( ) ) ;
209208 assert . equal ( workingCopyService . dirtyCount , 1 ) ;
210- assert . equal ( onDidChangeDirty , model ) ;
211209
212210 untitled . dispose ( ) ;
213- listener . dispose ( ) ;
214211 model . dispose ( ) ;
215212 } ) ;
216213
0 commit comments