Skip to content

Commit 4b88ac3

Browse files
committed
test: doc ref counting integ test with tab spacing config
1 parent f30b092 commit 4b88ac3

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

test/spec/Document-integ-test.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ define(function (require, exports, module) {
292292
// TODO: additional, simpler ref counting test cases such as Live Development, open/close inline editor (refs from
293293
// both editor & rule list TextRanges), navigate files w/o adding to working set, etc.
294294

295-
it("should clean up (later) a master Editor auto-created by calling read-only Document API, if Editor not used by UI", async function () {
295+
async function testRef(useAutoTabSpaces) {
296296
var promise,
297297
cssDoc,
298298
cssMasterEditor;
299-
Editor.Editor.setAutoTabSpaces(false);
299+
Editor.Editor.setAutoTabSpaces(useAutoTabSpaces);
300300
promise = CommandManager.execute(Commands.CMD_ADD_TO_WORKINGSET_AND_OPEN, {fullPath: HTML_FILE});
301301
await awaitsForDone(promise, "Open into working set");
302302

@@ -309,8 +309,12 @@ define(function (require, exports, module) {
309309

310310
// Force creation of master editor for CSS file
311311
cssDoc = DocumentManager.getOpenDocumentForPath(CSS_FILE);
312-
expect(cssDoc._masterEditor).toBeFalsy();
313-
DocumentManager.getOpenDocumentForPath(CSS_FILE).getLine(0);
312+
if(!useAutoTabSpaces){
313+
// if auto tab spaces is enabled, the space detect algo will read the file contents for detecting
314+
// spacing, so these 2 lines won't apply.
315+
expect(cssDoc._masterEditor).toBeFalsy();
316+
DocumentManager.getOpenDocumentForPath(CSS_FILE).getLine(0);
317+
}
314318
expect(cssDoc._masterEditor).toBeTruthy();
315319

316320
// Close inline editor
@@ -337,6 +341,14 @@ define(function (require, exports, module) {
337341
expect(testWindow.$(".CodeMirror").length).toBe(2); // HTML editor (working set) & JS editor (current)
338342

339343
cssDoc = cssMasterEditor = null;
344+
}
345+
346+
it("should clean up (later) a master Editor auto-created by calling read-only Document API, if Editor not used by UI", async function () {
347+
await testRef(false);
348+
});
349+
350+
it("should clean up (later) a master Editor in auto tab space detect mode, auto-created by calling read-only Document API, if Editor not used by UI", async function () {
351+
await testRef(true);
340352
});
341353
});
342354
});

0 commit comments

Comments
 (0)