Skip to content
Open
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
7,602 changes: 3,193 additions & 4,409 deletions package-lock.json

Large diffs are not rendered by default.

129 changes: 129 additions & 0 deletions test/core/widgets/prompt-bar-style.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import { expect } from '@esm-bundle/chai';
import { readFile } from '@web/test-runner-commands';

describe('prompt-bar-style.css', () => {
let css;

before(async () => {
css = await readFile({ path: '../../../unitylibs/core/widgets/prompt-bar-style/prompt-bar-style.css' });
});

describe('RTL — base inp-wrap direction (Change A)', () => {
it('contains direction: inherit', () => {
expect(css).to.include('direction: inherit');
});
});

describe('RTL — inp-field logical margin (Change B)', () => {
it('uses margin-inline-end: 5px', () => {
expect(css).to.include('margin-inline-end: 5px');
});

it('does not use physical margin: 0 5px 0 0', () => {
expect(css).not.to.include('margin: 0 5px 0 0');
});
});

describe('error toast opacity rule (Change C)', () => {
it('uses :has(.alert-holder.show) selector', () => {
expect(css).to.include(':has(.alert-holder.show)');
});

it('targets .unity-slf-style-container', () => {
expect(css).to.include(':has(.alert-holder.show) .unity-slf-style-container');
});

it('targets .ex-unity-wrap > :not(.alert-holder)', () => {
expect(css).to.include(':has(.alert-holder.show) .ex-unity-wrap > :not(.alert-holder)');
});

it('sets opacity to 0.05', () => {
expect(css).to.include('opacity: 0.05');
});
});

describe('RTL — unity-prompt-bar-style grid inp-wrap (Change D)', () => {
it('uses minmax(0, 1fr) to prevent grid overflow in RTL', () => {
expect(css).to.include('minmax(0, 1fr)');
});

it('does not use plain grid-template-columns: 1fr auto', () => {
expect(css).not.to.include('grid-template-columns: 1fr auto');
});

it('contains direction: inherit in unity-prompt-bar-style inp-wrap', () => {
const matches = css.match(/direction:\s*inherit/g);
expect(matches).to.have.length.at.least(2);
});
});

describe('RTL — logical justify-content values (Changes E, F, G)', () => {
it('uses justify-content: start (Change E and G)', () => {
expect(css).to.include('justify-content: start');
});

it('uses justify-content: end (Change F)', () => {
expect(css).to.include('justify-content: end');
});
});

describe('opacity rule — computed style behavior', () => {
let container;
let style;

before(() => {
style = document.createElement('style');
style.textContent = `
.unity-prompt-bar-style .unity-slf-left:has(.alert-holder.show) .unity-slf-style-container,
.unity-prompt-bar-style .unity-slf-left:has(.alert-holder.show) .ex-unity-wrap > :not(.alert-holder) {
opacity: 0.05;
}
`;
document.head.appendChild(style);

container = document.createElement('div');
container.className = 'unity-prompt-bar-style';
container.innerHTML = `
<div class="unity-slf-left">
<div class="alert-holder show"></div>
<div class="unity-slf-style-container"></div>
<div class="ex-unity-wrap">
<div class="other-child"></div>
<div class="alert-holder"></div>
</div>
</div>
`;
document.body.appendChild(container);
});

after(() => {
document.body.removeChild(container);
document.head.removeChild(style);
});

it('fades .unity-slf-style-container to 0.05 when .alert-holder has show class', () => {
const el = container.querySelector('.unity-slf-style-container');
expect(window.getComputedStyle(el).opacity).to.equal('0.05');
});

it('fades non-alert .ex-unity-wrap children to 0.05', () => {
const el = container.querySelector('.other-child');
expect(window.getComputedStyle(el).opacity).to.equal('0.05');
});

it('does not fade .alert-holder inside .ex-unity-wrap (excluded by :not)', () => {
const el = container.querySelector('.ex-unity-wrap .alert-holder');
expect(window.getComputedStyle(el).opacity).to.equal('1');
});

it('restores normal opacity when .alert-holder loses show class', () => {
const showAlert = container.querySelector('.alert-holder.show');
showAlert.classList.remove('show');

const el = container.querySelector('.unity-slf-style-container');
expect(window.getComputedStyle(el).opacity).to.equal('1');

showAlert.classList.add('show');
});
});
});
70 changes: 70 additions & 0 deletions test/core/widgets/prompt-bar.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { expect } from '@esm-bundle/chai';
import { readFile } from '@web/test-runner-commands';

describe('prompt-bar.css', () => {
let css;

before(async () => {
css = await readFile({ path: '../../../unitylibs/core/widgets/prompt-bar/prompt-bar.css' });
});

describe('RTL — base inp-wrap direction (Change A)', () => {
it('contains direction: inherit in .inp-wrap rule', () => {
expect(css).to.include('direction: inherit');
});
});

describe('RTL — max25/theme-two logical padding (Change B)', () => {
it('uses padding-block: 20px 18px instead of physical shorthand', () => {
expect(css).to.include('padding-block: 20px 18px');
});

it('uses padding-inline: 26px 22px instead of physical shorthand', () => {
expect(css).to.include('padding-inline: 26px 22px');
});

it('does not use physical padding: 20px 22px 18px 26px', () => {
expect(css).not.to.include('padding: 20px 22px 18px 26px');
});
});

describe('RTL — inp-field logical margin (Change C)', () => {
it('uses margin-inline-end: 5px', () => {
expect(css).to.include('margin-inline-end: 5px');
});

it('does not use physical margin: 0 5px 0 0', () => {
expect(css).not.to.include('margin: 0 5px 0 0');
});
});

describe('RTL — upload-marquee autocomplete logical margin (Change D)', () => {
it('uses margin-inline-start: 16px', () => {
expect(css).to.include('margin-inline-start: 16px');
});

it('does not use physical margin-left: 16px', () => {
expect(css).not.to.include('margin-left: 16px');
});
});

describe('RTL — upload-marquee widget logical padding (Change E)', () => {
it('uses padding-inline-start: 0', () => {
expect(css).to.include('padding-inline-start: 0');
});
});

describe('RTL — upload-marquee mobile breakpoint logical margin (Change F)', () => {
it('uses margin-block: 40px 0 in mobile breakpoint', () => {
expect(css).to.include('margin-block: 40px 0');
});

it('uses margin-inline: 0 40px in mobile breakpoint', () => {
expect(css).to.include('margin-inline: 0 40px');
});

it('does not use physical margin: 40px 40px 0 0', () => {
expect(css).not.to.include('margin: 40px 40px 0 0');
});
});
});
14 changes: 0 additions & 14 deletions test/core/workflow/workflow-acrobat/upload-handler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@ describe('UploadHandler', () => {
let mockNetworkUtils;
let mockTransitionScreen;

async function runWithFakeTimers(testFn, tickMs = 500) {
const clock = sinon.useFakeTimers();
try {
const promise = testFn();
clock.tick(tickMs);
await clock.runAllAsync();
return await promise;
} finally {
clock.restore();
}
}

before(async () => {
const originalImport = window.import;

Expand Down Expand Up @@ -687,14 +675,12 @@ describe('UploadHandler', () => {

describe('deleteFailedAssets', () => {
let assetsToDelete;
let accessToken;

beforeEach(() => {
assetsToDelete = [
{ id: 'asset1' },
{ id: 'asset2' },
];
accessToken = 'test-token';
mockNetworkUtils.fetchFromServiceWithRetry = sinon.stub().resolves({ response: {} });
});

Expand Down
9 changes: 3 additions & 6 deletions test/core/workflow/workflow-upload/action-binder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ describe('Unity Upload Block', () => {
const blob = await new Promise((resolve) => {
canvas.toBlob(resolve);
});
const objectUrl = URL.createObjectURL(blob);
URL.createObjectURL(blob);
});

it('should handle checkImageDimensions with dimensions exceeding limits using image file', async () => {
Expand Down Expand Up @@ -532,9 +532,7 @@ describe('Unity Upload Block', () => {

it('should return empty array when dataTransfer has no file items', () => {
const actionBinder = new ActionBinder(unityEl, workflowCfg, unityEl, [unityEl]);
const mockEvent = {
dataTransfer: { items: [{ kind: 'string', getAsFile: () => null }] },
};
const mockEvent = { dataTransfer: { items: [{ kind: 'string', getAsFile: () => null }] } };
expect(actionBinder.extractFiles(mockEvent)).to.deep.equal([]);
});

Expand Down Expand Up @@ -956,10 +954,9 @@ describe('Unity Upload Block', () => {
const blob = await new Promise((resolve) => {
canvas.toBlob(resolve, 'image/jpeg');
});
const objectUrl = URL.createObjectURL(blob);
URL.createObjectURL(blob);
});


it('should handle continueInApp with query parameters parsing', async () => {
const testWorkflowCfg = {
...workflowCfg,
Expand Down
2 changes: 1 addition & 1 deletion test/core/workflow/workflow-upload/upload-handler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ describe('UploadHandler', () => {
it('should handle abort signal', async () => {
const controller = new AbortController();
controller.abort();
const signal = controller.signal;
const { signal } = controller;
const file = new File(['test data'], 'test.txt', { type: 'text/plain' });
const uploadUrls = ['http://upload1.com'];
const blockSize = 20;
Expand Down
6 changes: 2 additions & 4 deletions test/core/workflow/workflow.firefly.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2279,9 +2279,7 @@ describe('Firefly Workflow Tests', () => {
});

it('should pass empty object to logAnalytics when splunkData is omitted', async () => {
await testActionBinder.sendFireflyAnalytics(new CustomEvent('firefly-analytics', {
detail: { adobeEventName: 'Enter Prompt|UnityWidget' },
}));
await testActionBinder.sendFireflyAnalytics(new CustomEvent('firefly-analytics', { detail: { adobeEventName: 'Enter Prompt|UnityWidget' } }));
expect(logStub.calledOnceWithExactly('Enter Prompt|UnityWidget', {})).to.be.true;
});
});
Expand Down Expand Up @@ -2758,7 +2756,7 @@ describe('Firefly Workflow Tests', () => {
{ label: 'Var A', url: 'https://u1' },
{ label: 'Var B', url: 'https://u2' },
{ label: 'Var C', url: 'https://u3' },
{ label: 'Var D', url: 'https://u4' }
{ label: 'Var D', url: 'https://u4' },
]);
expect(pm.image).to.exist;
expect(pm.image[0].variations).to.deep.equal([]);
Expand Down
3 changes: 1 addition & 2 deletions test/scripts/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ describe('Headers and Token', () => {
});
});

it.skip('Should return headers with empty string if refresh token fails', async function () {
this.timeout(5000); // Increase timeout to handle retry delay
it.skip('Should return headers with empty string if refresh token fails', async () => {
const token = { token: 'guest-token', expire: Date.now() - (10 * 60 * 1000) };
adobeIMSStub.returns(token);
const refreshTokenStub = sinon.stub(window.adobeIMS, 'refreshToken').rejects(new Error('Refresh token failed'));
Expand Down
Loading
Loading