Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buy Now Link Tests #27589

Merged
merged 7 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/devextreme-angular/tests/src/core/component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
WatcherHelper
} from 'devextreme-angular';

import config from 'devextreme/core/config';
// TODO: Try to replace dxButton to Widget ('require' required)
import dxButton from 'devextreme/ui/button';
let DxTestWidget = dxButton;
Expand Down Expand Up @@ -142,6 +143,10 @@ describe('DevExtreme Angular widget', () => {
expect(element.classList).toContain('dx-test-widget');
});

it('correctly sets the buy now link', () => {
expect(config().buyNowLink).toBe('https://go.devexpress.com/Licensing_Installer_Watermark_DevExtremeAngular.aspx');
});

it('should be disposed', () => {
let testSpy = spyOn(TestContainerComponent.prototype, 'testMethod');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as events from 'devextreme/events';
import config from 'devextreme/core/config';
import * as testingLib from '@testing-library/react';
import * as React from 'react';
import { useLayoutEffect } from 'react';
Expand Down Expand Up @@ -117,6 +118,10 @@ describe('rendering', () => {

testingLib.render(<MyComponent />);
});

it('correctly sets the buy now link', () => {
expect(config().buyNowLink).toBe('https://go.devexpress.com/Licensing_Installer_Watermark_DevExtremeReact.aspx');
});
});

describe('nested full components', () => {
Expand Down
5 changes: 5 additions & 0 deletions packages/devextreme-vue/src/core/__tests__/component.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PatchFlags } from '@vue/shared';
import { mount } from '@vue/test-utils';
import * as events from 'devextreme/events';
import config from 'devextreme/core/config';
import {
App, createVNode, defineComponent, h, nextTick, renderSlot,
} from 'vue';
Expand Down Expand Up @@ -156,6 +157,10 @@ describe('component rendering', () => {
expect(WidgetClass.mock.instances[1]).toEqual({});
});

it('correctly sets the buy now link', () => {
expect(config().buyNowLink).toBe('https://go.devexpress.com/Licensing_Installer_Watermark_DevExtremeVue.aspx');
});

describe('options', () => {
it('watch prop changing to undefined', (done) => {
const wrapper = mount(TestComponent, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import config from '@js/core/config';
import errors from '@js/core/errors';

import { base } from '../../ui/overlay/m_z_index';
Expand Down Expand Up @@ -364,6 +365,17 @@ describe('license check', () => {
expect(trialPanelSpy).not.toHaveBeenCalled();
});

test('Trial panel "Buy Now" link must use the jQuery link if no config has been set', () => {
validateLicense('', '1.2');
expect(trialPanelSpy?.mock.calls[0][0]).toBe('https://go.devexpress.com/Licensing_Installer_Watermark_DevExtremeJQuery.aspx');
});

test('Trial panel "Buy Now" link must use the value from the config', () => {
config({ buyNowLink: 'trial-panel-link.com' });
validateLicense('', '1.2');
expect(trialPanelSpy?.mock.calls[0][0]).toBe('trial-panel-link.com');
});

test('Message should be logged only once', () => {
validateLicense('', '1.0');
validateLicense('', '1.0');
Expand Down
Loading