devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
52 lines (51 loc) • 2.45 kB
JavaScript
/**
* DevExtreme (esm/__internal/core/license/trial_panel.client.test.js)
* Version: 25.2.5
* Build date: Fri Feb 20 2026
*
* Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import {
beforeEach,
describe,
expect,
it
} from "@jest/globals";
import {
renderTrialPanel
} from "./trial_panel.client";
describe("trial panel client", (() => {
beforeEach((() => {
document.body.innerHTML = ""
}));
it("should not display subscription text when subscriptions parameter is empty string", (() => {
renderTrialPanel("https://example.com/buy", "https://example.com/docs", "25.2.0", "");
const triggerElement = document.querySelector("dx-license-trigger");
expect(triggerElement).not.toBeNull();
const panelElement = document.querySelector("dx-license");
if (panelElement) {
const text = panelElement.textContent ?? "";
expect(text).not.toContain("Included in Subscriptions:")
}
}));
it("should set subscriptions attribute when parameter is a valid string", (() => {
renderTrialPanel("https://example.com/buy", "https://example.com/docs", "25.2.0", "Universal, DXperience");
const triggerElement = document.querySelector("dx-license-trigger");
expect(triggerElement).not.toBeNull();
const subscriptionsAttr = null === triggerElement || void 0 === triggerElement ? void 0 : triggerElement.getAttribute("subscriptions");
expect(subscriptionsAttr).toBe("Universal, DXperience")
}));
it("should not display subscription text when subscriptions parameter is actual null", (() => {
renderTrialPanel("https://example.com/buy", "https://example.com/docs", "25.2.0", null);
const triggerElement = document.querySelector("dx-license-trigger");
expect(triggerElement).not.toBeNull();
const subscriptionsAttr = null === triggerElement || void 0 === triggerElement ? void 0 : triggerElement.getAttribute("subscriptions");
expect(subscriptionsAttr).toBe("");
const panelElement = document.querySelector("dx-license");
if (panelElement) {
const text = panelElement.textContent ?? "";
expect(text).not.toContain("Included in Subscriptions: null")
}
}))
}));