Skip to content

Commit 5d6c0d1

Browse files
devvaannshabose
authored andcommitted
feat: integ tests for external file paths with ellipsis
1 parent 394a281 commit 5d6c0d1

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

test/spec/WorkingSetView-integ-test.js

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
*/
2121

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 */
2323

2424
define(function (require, exports, module) {
2525

@@ -226,28 +226,33 @@ define(function (require, exports, module) {
226226
expect($list.find(".directory").length).toBe(0);
227227
});
228228

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;
232233

233-
// First we need to open another file
234234
await openAndMakeDirty(externalProjectTestPath + "/test.js");
235235

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");
238238

239-
// Two files with the same name file_one.js should be now opened
239+
// get the directory path
240240
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);
244243

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
246254
DocumentManager.getCurrentDocument()._markClean(); // so we can close without a save dialog
247255
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);
251256
});
252257

253258
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

Comments
 (0)