<commit_before>import { IntSliderView } from "@jupyter-widgets/controls";
import { WidgetManager } from "../../src/manager/widget-manager";
import { DOMWidgetModel } from "@jupyter-widgets/base";

describe("WidgetManager", () => {
  describe("loadClass", () => {
    it("returns a class if it exists", () => {
      const modelById = (id: string) => undefined;
      const manager = new WidgetManager(null, modelById);
      const view = manager.loadClass(
        "IntSliderView",
        "@jupyter-widgets/controls",
        "1.5.0"
      );
      expect(view).not.toBe(null);
    });
  });
  describe("create_view", () => {
    it("returns a widget mounted on the provided element", async () => {
      const modelById = (id: string) => undefined;
      const manager = new WidgetManager(null, modelById);
      const model = {
        _dom_classes: [],
        _model_module: "@jupyter-widgets/controls",
        _model_module_version: "1.5.0",
        _model_name: "IntSliderModel",
        _view_count: null,
        _view_module: "@jupyter-widgets/controls",
        _view_module_version: "1.5.0",
        _view_name: "IntSliderView",
        continuous_update: false,
        description: "Test:",
        description_tooltip: null,
        disabled: false,
        max: 10,
        min: 0,
        orientation: "horizontal",
        readout: true,
        readout_format: "d",
        step: 1,
        value: 7
      };
      const widget = await manager.create_view(model, {
        el: document.createElement("div"),
        model_id: "test_model_id"
      });
      expect(widget).not.toBeNull();
      expect(widget instanceof IntSliderView).toBe(true);
    });
  });
});<commit_msg>Updated an ipywidgets test<commit_after>import { IntSliderView } from "@jupyter-widgets/controls";
import { WidgetManager } from "../../src/manager/widget-manager";
import { DOMWidgetModel } from "@jupyter-widgets/base";

describe("WidgetManager", () => {
  describe("loadClass", () => {
    it("returns a class if it exists", () => {
      const modelById = (id: string) => undefined;
      const manager = new WidgetManager(null, modelById);
      const view = manager.loadClass(
        "IntSliderView",
        "@jupyter-widgets/controls",
        "1.5.0"
      );
      expect(view).not.toBe(null);
    });
  });
  describe("create_view", () => {
    it("returns a widget mounted on the provided element", async () => {
      const modelById = (id: string) => undefined;
      const manager = new WidgetManager(null, modelById);
      const model = {
        _dom_classes: [],
        _model_module: "@jupyter-widgets/controls",
        _model_module_version: "1.5.0",
        _model_name: "IntSliderModel",
        _view_count: null,
        _view_module: "@jupyter-widgets/controls",
        _view_module_version: "1.5.0",
        _view_name: "IntSliderView",
        continuous_update: false,
        description: "Test:",
        description_tooltip: null,
        disabled: false,
        max: 10,
        min: 0,
        orientation: "horizontal",
        readout: true,
        readout_format: "d",
        step: 1,
        value: 7
      };
      const widget = await manager.new_widget_from_state_and_id(
        model,
        "test_model_id"
      );
      const view = await manager.create_view(
        widget,
        {},
        document.createElement("div")
      );
      expect(view).not.toBeNull();
      expect(view instanceof IntSliderView).toBe(true);
    });
  });
});
{'fraction_non_alphanumeric': 0.14146620847651775, 'fraction_numerical': 0.008018327605956471, 'mean_word_length': 2.4964964964964964, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7056971', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1054, 'n_words': 223}