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

Commit aa9d15b

Browse files
2007heavennchevobbe
authored andcommitted
Add additional fullText tests
and use ELLIPSIS constant in string rep tests
1 parent 86db0fb commit aa9d15b

File tree

2 files changed

+38
-6
lines changed

2 files changed

+38
-6
lines changed

packages/devtools-reps/src/reps/tests/long-string.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ const {
88
getRep,
99
} = require("../rep");
1010

11+
const {
12+
ELLIPSIS,
13+
} = require("../rep-utils");
14+
1115
const {
1216
expectActorAttribute,
1317
} = require("./test-helpers");
@@ -32,7 +36,8 @@ describe("long StringRep", () => {
3236
object: stub
3337
}));
3438

35-
expect(renderedComponent.text()).toEqual(quoteNewlines(`"${stub.initial}…"`));
39+
expect(renderedComponent.text())
40+
.toEqual(quoteNewlines(`"${stub.initial}${ELLIPSIS}"`));
3641
expectActorAttribute(renderedComponent, stub.actor);
3742
});
3843

@@ -44,7 +49,7 @@ describe("long StringRep", () => {
4449
cropLimit: 20
4550
}));
4651

47-
expect(renderedComponent.text()).toEqual(`"a\\naaaaaaaaaaaaaaaaaa"`);
52+
expect(renderedComponent.text()).toEqual(`"a\\naaaaaaaaaaaaaaaaaa${ELLIPSIS}"`);
4853
});
4954

5055
it("renders with expected text content for multiline string when open", () => {
@@ -56,7 +61,7 @@ describe("long StringRep", () => {
5661
}));
5762

5863
expect(renderedComponent.text())
59-
.toEqual(quoteNewlines(`"${stub.initial}"`));
64+
.toEqual(quoteNewlines(`"${stub.initial}${ELLIPSIS}"`));
6065
});
6166

6267
it("renders with expected text content when grip has a fullText" +
@@ -79,7 +84,7 @@ describe("long StringRep", () => {
7984
cropLimit: 20
8085
}));
8186

82-
expect(renderedComponent.text()).toEqual(`"a\\naaaaaaaaaaaaaaaaaa"`);
87+
expect(renderedComponent.text()).toEqual(`"a\\naaaaaaaaaaaaaaaaaa${ELLIPSIS}"`);
8388
});
8489

8590
it("expected to omit quotes", () => {
@@ -92,6 +97,7 @@ describe("long StringRep", () => {
9297

9398
expect(renderedComponent.html())
9499
.toEqual('<span data-link-actor-id="server1.conn1.child1/longString58" ' +
95-
'class="objectBox objectBox-string">a\naaaaaaaaaaaaaaaaaa…</span>');
100+
`class="objectBox objectBox-string">a\naaaaaaaaaaaaaaaaaa${ELLIPSIS}` +
101+
"</span>");
96102
});
97103
});

packages/devtools-reps/src/reps/tests/string.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

55
const { shallow } = require("enzyme");
6+
const { ELLIPSIS } = require("../rep-utils");
67
const { REPS } = require("../rep");
78
const { Rep } = REPS;
89

@@ -18,7 +19,7 @@ const testCases = [{
1819
object: "aaaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbb\ncccccccccccccccc\n",
1920
cropLimit: 20
2021
},
21-
result: "\"aaaaaaaaacccccc\\n\""
22+
result: `\"aaaaaaaaa${ELLIPSIS}cccccc\\n\"`
2223
}, {
2324
name: "testMultilineOpen",
2425
props: {
@@ -70,6 +71,31 @@ const testCases = [{
7071
escapeWhitespace: false,
7172
},
7273
result: "\"line 1\r\nline 2\n\tline 3\""
74+
}, {
75+
name: "testIgnoreFullTextWhenOpen",
76+
props: {
77+
object: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
78+
fullText: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
79+
member: {open: true},
80+
},
81+
result: "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\""
82+
}, {
83+
name: "testIgnoreFullTextWithLimit",
84+
props: {
85+
object: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
86+
fullText: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
87+
cropLimit: 20,
88+
},
89+
result: `\"aaaaaaaaa${ELLIPSIS}aaaaaaaa\"`
90+
}, {
91+
name: "testIgnoreFullTextWhenOpenWithLimit",
92+
props: {
93+
object: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
94+
fullText: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
95+
member: {open: true},
96+
cropLimit: 20,
97+
},
98+
result: "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\""
7399
}];
74100

75101
describe("test String", () => {

0 commit comments

Comments
 (0)