1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
"use strict";
const { shallow } = require("enzyme");
const {
REPS,
} = require("resource://devtools/client/shared/components/reps/reps/rep.js");
const { Rep } = REPS;
const stubs = require("resource://devtools/client/shared/components/test/node/stubs/reps/symbol.js");
const {
expectActorAttribute,
} = require("resource://devtools/client/shared/components/test/node/components/reps/test-helpers.js");
describe("test Symbol", () => {
const stub = stubs.get("Symbol");
it("renders with the expected content", () => {
const renderedComponent = shallow(
Rep({
object: stub,
shouldRenderTooltip: true,
})
);
expect(renderedComponent.text()).toEqual('Symbol("foo")');
expect(renderedComponent.prop("title")).toBe("Symbol(foo)");
expectActorAttribute(renderedComponent, stub.actor);
});
});
describe("test Symbol without identifier", () => {
const stub = stubs.get("SymbolWithoutIdentifier");
it("renders the expected content", () => {
const renderedComponent = shallow(
Rep({
object: stub,
})
);
expect(renderedComponent.text()).toEqual("Symbol()");
expectActorAttribute(renderedComponent, stub.actor);
});
});
describe("test Symbol with long string", () => {
const stub = stubs.get("SymbolWithLongString");
it("renders the expected content", () => {
const renderedComponent = shallow(
Rep({
object: stub,
})
);
expect(renderedComponent.text()).toEqual(
'Symbol("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa…")'
);
expectActorAttribute(renderedComponent, stub.actor);
});
});
|