Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 9f0825d

Browse files
author
Marcel Gerber
authored
Merge pull request #12700 from ficristo/fix-filetreeview-tests
Update tests after #12047
2 parents f2d82ac + 1c2a74d commit 9f0825d

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

test/spec/FileTreeView-test.js

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ define(function (require, exports, module) {
4444
entry: Immutable.Map()
4545
}));
4646
var a = RTU.findRenderedDOMComponentWithTag(rendered, "a");
47-
expect(a.children[1].textContent).toBe("afile");
48-
expect(a.children[2].textContent).toBe(".js");
49-
expect(a.children[0].textContent).toBe(" ");
47+
expect(a.children[0].textContent).toBe("");
48+
expect(a.children[1].textContent).toBe(" ");
49+
expect(a.children[2].textContent).toBe("afile");
50+
expect(a.children[3].textContent).toBe(".js");
5051
});
5152

5253
it("should call icon extensions to replace the default icon", function () {
@@ -69,9 +70,10 @@ define(function (require, exports, module) {
6970
expect(extensionCalls).toBe(1);
7071

7172
var a = RTU.findRenderedDOMComponentWithTag(rendered, "a");
72-
expect(a.children[1].textContent).toBe("afile");
73-
expect(a.children[2].textContent).toBe(".js");
74-
expect(a.children[0].textContent).toBe("ICON");
73+
expect(a.children[0].textContent).toBe("");
74+
expect(a.children[1].textContent).toBe("ICON");
75+
expect(a.children[2].textContent).toBe("afile");
76+
expect(a.children[3].textContent).toBe(".js");
7577
});
7678

7779
it("should allow icon extensions to return a string for the icon", function () {
@@ -91,8 +93,9 @@ define(function (require, exports, module) {
9193
expect(extensionCalls).toBe(1);
9294

9395
var a = RTU.findRenderedDOMComponentWithTag(rendered, "a");
94-
expect(a.children[1].textContent).toBe("afile");
95-
expect(a.children[2].textContent).toBe(".js");
96+
expect(a.children[0].textContent).toBe("");
97+
expect(a.children[2].textContent).toBe("afile");
98+
expect(a.children[3].textContent).toBe(".js");
9699

97100
var $a = $(ReactDOM.findDOMNode(a)),
98101
$ins = $a.find("ins");
@@ -166,8 +169,9 @@ define(function (require, exports, module) {
166169
expect(extensionCalls).toBe(1);
167170

168171
var a = RTU.findRenderedDOMComponentWithTag(rendered, "a");
169-
expect(a.children[1].textContent).toBe("afile");
170-
expect(a.children[2].textContent).toBe(".js");
172+
expect(a.children[0].textContent).toBe("");
173+
expect(a.children[2].textContent).toBe("afile");
174+
expect(a.children[3].textContent).toBe(".js");
171175

172176
var $a = $(a),
173177
$ins = $a.find("ins");
@@ -377,8 +381,8 @@ define(function (require, exports, module) {
377381
dirA = $(dirLI).find("a")[0];
378382

379383
expect(dirLI.className).toBe("jstree-closed new classes are cool");
380-
var icon = dirA.children[0];
381-
expect(icon.textContent).toBe("ICON");
384+
expect(dirA.children[0].textContent).toBe("");
385+
expect(dirA.children[1].textContent).toBe("ICON");
382386
});
383387

384388
it("should allow renaming a closed directory", function () {
@@ -401,7 +405,7 @@ define(function (require, exports, module) {
401405
}));
402406
var fileLI = ReactDOM.findDOMNode(rendered),
403407
fileA = $(fileLI).find("a")[0];
404-
expect(fileA.children[1].textContent).toBe("afile");
408+
expect(fileA.children[2].textContent).toBe("afile");
405409
});
406410

407411
it("should be able to list closed directories", function () {
@@ -419,7 +423,7 @@ define(function (require, exports, module) {
419423

420424
var subdirLI = ReactDOM.findDOMNode(rendered),
421425
subdirA = $(subdirLI).find(".jstree-closed > a")[0];
422-
expect(subdirA.children[1].textContent).toBe("subdir");
426+
expect(subdirA.children[2].textContent).toBe("subdir");
423427
});
424428

425429
it("should be able to list open subdirectories", function () {
@@ -433,8 +437,8 @@ define(function (require, exports, module) {
433437
aTags = subdirLI.find("a");
434438

435439
expect(aTags.length).toBe(2);
436-
expect(aTags[0].children[1].textContent).toBe("subdir");
437-
expect(aTags[1].children[1].textContent).toBe("afile");
440+
expect(aTags[0].children[2].textContent).toBe("subdir");
441+
expect(aTags[1].children[2].textContent).toBe("afile");
438442
});
439443

440444
it("should sort directory contents according to the flag", function () {
@@ -516,8 +520,8 @@ define(function (require, exports, module) {
516520
var rootNode = ReactDOM.findDOMNode(rendered),
517521
aTags = $(rootNode).find("a");
518522
expect(aTags.length).toBe(2);
519-
expect(aTags[0].children[1].textContent).toBe("subdir");
520-
expect(aTags[1].children[1].textContent).toBe("afile");
523+
expect(aTags[0].children[2].textContent).toBe("subdir");
524+
expect(aTags[1].children[2].textContent).toBe("afile");
521525
});
522526

523527
it("should rerender contents as needed", function () {

0 commit comments

Comments
 (0)