Skip to content

Commit

Permalink
Change single to double quote
Browse files Browse the repository at this point in the history
  • Loading branch information
sufyanAbbasi committed Nov 14, 2024
1 parent 46e83f9 commit f55ffd3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
22 changes: 11 additions & 11 deletions tests/layer_manager.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { AnyModel } from '@anywidget/types';
import '../js/layer_manager';
import { AnyModel } from "@anywidget/types";
import "../js/layer_manager";

import { default as layerManagerRender, LayerManager, LayerManagerModel } from '../js/layer_manager';
import { FakeAnyModel } from './fake_anywidget';
import { default as layerManagerRender, LayerManager, LayerManagerModel } from "../js/layer_manager";
import { FakeAnyModel } from "./fake_anywidget";

describe('<layer-manager>', () => {
describe("<layer-manager>", () => {
let layerManager: LayerManager;

async function makeManager(model: AnyModel<LayerManagerModel>) {
const container = document.createElement('div');
const container = document.createElement("div");
layerManagerRender.render({
model, el: container, experimental: {
invoke: () => new Promise(() => [model, []]),
Expand All @@ -28,21 +28,21 @@ describe('<layer-manager>', () => {
});

afterEach(() => {
Array.from(document.querySelectorAll('layer-manager')).forEach((el) => {
Array.from(document.querySelectorAll("layer-manager")).forEach((el) => {
el.remove();
})
});

it('can be instantiated.', async () => {
expect(layerManager.shadowRoot?.querySelector('.all-layers-text')).toBeDefined();
it("can be instantiated.", async () => {
expect(layerManager.shadowRoot?.querySelector(".all-layers-text")).toBeDefined();
});

it('sets model properties on property change.', async () => {
it("sets model properties on property change.", async () => {
const setSpy = spyOn(FakeAnyModel.prototype, "set");
const saveSpy = spyOn(FakeAnyModel.prototype, "save_changes");
layerManager.visible = false;
await layerManager.updateComplete;
expect(setSpy).toHaveBeenCalledOnceWith('visible', false);
expect(setSpy).toHaveBeenCalledOnceWith("visible", false);
expect(saveSpy).toHaveBeenCalledTimes(1);
});
});
34 changes: 17 additions & 17 deletions tests/layer_manager_row.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { AnyModel } from '@anywidget/types';
import '../js/layer_manager_row';
import { default as rowRender, LayerManagerRow, LayerManagerRowModel } from '../js/layer_manager_row';
import { FakeAnyModel } from './fake_anywidget';
import { AnyModel } from "@anywidget/types";
import "../js/layer_manager_row";
import { default as rowRender, LayerManagerRow, LayerManagerRowModel } from "../js/layer_manager_row";
import { FakeAnyModel } from "./fake_anywidget";

describe('<layer-manager-row>', () => {
describe("<layer-manager-row>", () => {
let row: LayerManagerRow;

async function makeRow(model: AnyModel<LayerManagerRowModel>) {
const container = document.createElement('div');
const container = document.createElement("div");
rowRender.render({
model, el: container, experimental: {
invoke: () => new Promise(() => [model, []]),
Expand All @@ -21,36 +21,36 @@ describe('<layer-manager-row>', () => {

beforeEach(async () => {
row = await makeRow(new FakeAnyModel<LayerManagerRowModel>({
name: 'Test Layer',
name: "Test Layer",
visible: true,
opacity: 1,
is_loading: false,
}));
});

afterEach(() => {
Array.from(document.querySelectorAll('layer-manager-row')).forEach((el) => {
Array.from(document.querySelectorAll("layer-manager-row")).forEach((el) => {
el.remove();
})
});

it('can be instantiated.', () => {
expect(row.shadowRoot?.querySelector('.layer-name')?.textContent).toContain('Test Layer');
it("can be instantiated.", () => {
expect(row.shadowRoot?.querySelector(".layer-name")?.textContent).toContain("Test Layer");
});

it('sets model properties on property change.', async () => {
it("sets model properties on property change.", async () => {
const setSpy = spyOn(FakeAnyModel.prototype, "set");
const saveSpy = spyOn(FakeAnyModel.prototype, "save_changes");
row.opacity = 0.5;
await row.updateComplete;
expect(setSpy).toHaveBeenCalledOnceWith('opacity', 0.5);
expect(setSpy).toHaveBeenCalledOnceWith("opacity", 0.5);
expect(saveSpy).toHaveBeenCalledTimes(1);
});

it('emits model events when clicked.', async () => {
it("emits model events when clicked.", async () => {
// Settings button emits an event.
const sendSpy = spyOn(FakeAnyModel.prototype, "send");
(row.shadowRoot?.querySelector('.settings-button') as HTMLButtonElement).click();
(row.shadowRoot?.querySelector(".settings-button") as HTMLButtonElement).click();
expect(FakeAnyModel.prototype.send).toHaveBeenCalledOnceWith({
type: "click",
id: "settings"
Expand All @@ -59,10 +59,10 @@ describe('<layer-manager-row>', () => {
sendSpy.calls.reset();

// Deletion button emits an event.
(row.shadowRoot?.querySelector('.delete-button') as HTMLButtonElement).click();
(row.shadowRoot?.querySelector(".delete-button") as HTMLButtonElement).click();
await row.updateComplete;
(row.shadowRoot?.querySelector('.confirm-deletion-button') as HTMLButtonElement).click();
expect(FakeAnyModel.prototype.send).toHaveBeenCalledOnceWith({
(row.shadowRoot?.querySelector(".confirm-deletion-button") as HTMLButtonElement).click();
expect(sendSpy).toHaveBeenCalledOnceWith({
type: "click",
id: "delete"
});
Expand Down

0 comments on commit f55ffd3

Please sign in to comment.