|
19 | 19 | * |
20 | 20 | */ |
21 | 21 |
|
22 | | -/*global describe, it, expect, beforeEach, afterEach, awaitsFor, awaitsForDone, beforeAll, afterAll, awaits */ |
| 22 | +/*global describe, it, expect, beforeEach, afterEach, awaitsFor, awaitsForDone, beforeAll, afterAll, awaits, path */ |
23 | 23 |
|
24 | 24 | define(function (require, exports, module) { |
25 | 25 |
|
@@ -226,28 +226,33 @@ define(function (require, exports, module) { |
226 | 226 | expect($list.find(".directory").length).toBe(0); |
227 | 227 | }); |
228 | 228 |
|
229 | | - it("should show full path next to the file name when file is outside current project", async function () { |
230 | | - // Count currently opened files |
231 | | - var workingSetListItemCountBeforeTest = workingSetListItemCount; |
| 229 | + it("should show ellipsis on external project files", async function () { |
| 230 | + // empty the working set |
| 231 | + await testWindow.closeAllFiles(); |
| 232 | + workingSetListItemCount = 0; |
232 | 233 |
|
233 | | - // First we need to open another file |
234 | 234 | await openAndMakeDirty(externalProjectTestPath + "/test.js"); |
235 | 235 |
|
236 | | - // Wait for file to be added to the working set |
237 | | - await awaitsFor(function () { return workingSetListItemCount === workingSetListItemCountBeforeTest + 1; }); |
| 236 | + // wait for the file to add to the working set |
| 237 | + await awaitsFor(function () { return workingSetListItemCount === 1; }, "Open file count to be 1"); |
238 | 238 |
|
239 | | - // Two files with the same name file_one.js should be now opened |
| 239 | + // get the directory path |
240 | 240 | var $list = testWindow.$(".open-files-container > ul"); |
241 | | - const fullPathSpan = $list.find(".directory"); |
242 | | - expect(fullPathSpan.length).toBe(1); |
243 | | - expect(fullPathSpan[0].innerHTML.includes(Phoenix.app.getDisplayPath(externalProjectTestPath))).toBe(true); |
| 241 | + const directorySpan = $list.find(".directory"); |
| 242 | + expect(directorySpan.length).toBe(1); |
244 | 243 |
|
245 | | - // Now close last opened file to hide the directories again |
| 244 | + // get the text from the directory path |
| 245 | + const directoryText = directorySpan[0].innerHTML; |
| 246 | + |
| 247 | + // check if the directory path has ellipsis |
| 248 | + expect(directoryText.includes("\u2026")).toBe(true); |
| 249 | + |
| 250 | + // the title should contain the full path |
| 251 | + expect(directorySpan.attr('title')).toBe(Phoenix.app.getDisplayPath(path.dirname(externalProjectTestPath + "/test.js"))); |
| 252 | + |
| 253 | + // Clean up |
246 | 254 | DocumentManager.getCurrentDocument()._markClean(); // so we can close without a save dialog |
247 | 255 | await awaitsForDone(CommandManager.execute(Commands.FILE_CLOSE), "timeout on FILE_CLOSE", 1000); |
248 | | - |
249 | | - // there should be no more directories shown |
250 | | - expect($list.find(".directory").length).toBe(0); |
251 | 256 | }); |
252 | 257 |
|
253 | 258 | it("should show different directory names, when two files of the same name are opened, located in folders with same name", async function () { |
|
0 commit comments