{"size": 1853, "ext": "js", "max_stars_repo_path": "Specs/Widgets/VRButton/VRButtonSpec.js", "max_stars_repo_name": "solarcellsky/cesium_electron", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Specs/Widgets/VRButton/VRButtonSpec.js", "max_issues_repo_name": "solarcellsky/cesium_electron", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Specs/Widgets/VRButton/VRButtonSpec.js", "max_forks_repo_name": "solarcellsky/cesium_electron", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.8833333333, "max_line_length": 67, "alphanum_fraction": 0.6783594172}
import createScene from "../../createScene.js";
import { VRButton } from "../../Source/Cesium.js";

describe("Widgets/VRButton/VRButton", function () {
  var scene;

  beforeEach(function () {
    scene = createScene();
  });

  afterEach(function () {
    scene.destroyForSpecs();
  });

  it("constructor sets default values", function () {
    var vrButton = new VRButton(document.body, scene);
    expect(vrButton.container).toBe(document.body);
    expect(vrButton.viewModel.vrElement).toBe(document.body);
    expect(vrButton.isDestroyed()).toEqual(false);
    vrButton.destroy();
    expect(vrButton.isDestroyed()).toEqual(true);
  });

  it("constructor sets expected values", function () {
    var testElement = document.createElement("span");
    var vrButton = new VRButton(document.body, scene, testElement);
    expect(vrButton.container).toBe(document.body);
    expect(vrButton.viewModel.vrElement).toBe(testElement);
    vrButton.destroy();
  });

  it("constructor works with string id container", function () {
    var testElement = document.createElement("span");
    testElement.id = "testElement";
    document.body.appendChild(testElement);
    var vrButton = new VRButton("testElement", scene);
    expect(vrButton.container).toBe(testElement);
    document.body.removeChild(testElement);
    vrButton.destroy();
  });

  it("throws if container is undefined", function () {
    expect(function () {
      return new VRButton(undefined, scene);
    }).toThrowDeveloperError();
  });

  it("throws if container string is undefined", function () {
    expect(function () {
      return new VRButton("testElement", scene);
    }).toThrowDeveloperError();
  });

  it("throws if scene is undefined", function () {
    expect(function () {
      return new VRButton(document.body, undefined);
    }).toThrowDeveloperError();
  });
});
