15832144755
2022-01-06 7b4c8991dca9cf2a809a95e239d144697d3afb56
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
import { Ellipsoid } from "../../../Source/Cesium.js";
import { Globe } from "../../../Source/Cesium.js";
import createScene from "../../createScene.js";
import { CesiumInspector } from "../../../Source/Cesium.js";
 
describe(
  "Widgets/CesiumInspector/CesiumInspector",
  function () {
    var scene;
    beforeAll(function () {
      scene = createScene();
      var ellipsoid = Ellipsoid.UNIT_SPHERE;
      var globe = new Globe(ellipsoid);
      scene.globe = globe;
    });
 
    afterAll(function () {
      scene.destroyForSpecs();
    });
 
    it("can create and destroy", function () {
      var container = document.createElement("div");
      container.id = "testContainer";
      document.body.appendChild(container);
 
      var widget = new CesiumInspector("testContainer", scene);
      expect(widget.container).toBe(container);
      expect(widget.viewModel.scene).toBe(scene);
      expect(widget.isDestroyed()).toEqual(false);
      widget.destroy();
      expect(widget.isDestroyed()).toEqual(true);
 
      document.body.removeChild(container);
    });
 
    it("constructor throws with no element", function () {
      expect(function () {
        return new CesiumInspector();
      }).toThrowDeveloperError();
    });
 
    it("constructor throws with string element that does not exist", function () {
      expect(function () {
        return new CesiumInspector("does not exist", scene);
      }).toThrowDeveloperError();
    });
 
    it("constructor throws with no scene", function () {
      expect(function () {
        return new CesiumInspector(document.body);
      }).toThrowDeveloperError();
    });
  },
  "WebGL"
);