Skip to content
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 .changeset/gold-goats-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lynx-js/web-core": patch
---

fix: lynx-view `updateGlobalProps` method will also update globalProps, so `reload()` will use the latest updated globalProps.
1 change: 1 addition & 0 deletions packages/web-platform/web-core/src/apis/LynxView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export class LynxView extends HTMLElement {
*/
updateGlobalProps(data: Cloneable) {
this.#instance?.updateGlobalProps(data);
this.globalProps = data;
}

/**
Expand Down
21 changes: 21 additions & 0 deletions packages/web-platform/web-tests/tests/react.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { swipe, dragAndHold } from './utils.js';
import { test, expect } from './coverage-fixture.js';
import type { Page } from '@playwright/test';
import type { LynxView } from '../../web-core/src/index.js';
const ENABLE_MULTI_THREAD = !!process.env['ENABLE_MULTI_THREAD'];
const wait = async (ms: number) => {
await new Promise((resolve) => {
Expand Down Expand Up @@ -148,6 +149,26 @@
'green',
);
});
test('basic-globalProps-reload', async ({ page }, { title }) => {
await goto(page, 'basic-globalProps');
await wait(100);
expect(await page.locator('#target').getAttribute('style')).toContain(
'pink',
);
await page.evaluate(() => {
(document.querySelector('lynx-view') as LynxView)?.updateGlobalProps({
backgroundColor: 'green',
});
});
await wait(500);
await page.evaluate(() => {
(document.querySelector('lynx-view') as LynxView)?.reload();
});
await wait(500);
expect(await page.locator('#target').getAttribute('style')).toContain(
'green',
);
});
test('basic-event-dataset', async ({ page }, { title }) => {
await goto(page, title);
await wait(100);
Expand Down Expand Up @@ -630,7 +651,7 @@
document.querySelector('lynx-view')!.remove();
});
await wait(50);
expect(message).toContain('fin');

Check failure on line 654 in packages/web-platform/web-tests/tests/react.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (Default) / check

[chromium] › tests/react.spec.ts:642:5 › reactlynx3 tests › apis › api-dispose

6) [chromium] › tests/react.spec.ts:642:5 › reactlynx3 tests › apis › api-dispose ──────────────── Error: expect(received).toContain(expected) // indexOf Expected value: "fin" Received array: ["NYI: profileStart. This is an issue of lynx-core.", "NYI: profileEnd. This is an issue of lynx-core."] 652 | }); 653 | await wait(50); > 654 | expect(message).toContain('fin'); | ^ 655 | expect(page.workers().length).toStrictEqual(1); 656 | }); 657 | at /home/runner/_work/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:654:23

Check failure on line 654 in packages/web-platform/web-tests/tests/react.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (Default) / check

[webkit] › tests/react.spec.ts:642:5 › reactlynx3 tests › apis › api-dispose

2) [webkit] › tests/react.spec.ts:642:5 › reactlynx3 tests › apis › api-dispose ────────────────── Error: expect(received).toContain(expected) // indexOf Expected value: "fin" Received array: [] 652 | }); 653 | await wait(50); > 654 | expect(message).toContain('fin'); | ^ 655 | expect(page.workers().length).toStrictEqual(1); 656 | }); 657 | at /home/runner/_work/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:654:23
expect(page.workers().length).toStrictEqual(1);
});

Expand Down Expand Up @@ -1259,7 +1280,7 @@
await target.click();
await expect(await target.getAttribute('style')).toContain('green');
await target.click();
await expect(await target.getAttribute('style')).toContain('pink');

Check failure on line 1283 in packages/web-platform/web-tests/tests/react.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (Default) / check

[webkit] › tests/react.spec.ts:1276:5 › reactlynx3 tests › configs › config-mode-dev-with-all-in-one

3) [webkit] › tests/react.spec.ts:1276:5 › reactlynx3 tests › configs › config-mode-dev-with-all-in-one Error: expect(received).toContain(expected) // indexOf Expected substring: "pink" Received string: "height:100px;width:100px;background:green;" 1281 | await expect(await target.getAttribute('style')).toContain('green'); 1282 | await target.click(); > 1283 | await expect(await target.getAttribute('style')).toContain('pink'); | ^ 1284 | }); 1285 | 1286 | test( at /home/runner/_work/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:1283:56
});

test(
Expand Down Expand Up @@ -2303,7 +2324,7 @@
inputDom?.setSelectionRange(2, 5);
});
const result = await page.locator('.result').first().innerText();
expect(result).toBe('2-5');

Check failure on line 2327 in packages/web-platform/web-tests/tests/react.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (Default) / check

[chromium] › tests/react.spec.ts:2315:7 › reactlynx3 tests › elements › x-input › basic-element-x-input-bindselection

7) [chromium] › tests/react.spec.ts:2315:7 › reactlynx3 tests › elements › x-input › basic-element-x-input-bindselection Error: expect(received).toBe(expected) // Object.is equality Expected: "2-5" Received: "" 2325 | }); 2326 | const result = await page.locator('.result').first().innerText(); > 2327 | expect(result).toBe('2-5'); | ^ 2328 | }, 2329 | ); 2330 | test( at /home/runner/_work/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:2327:26
},
);
test(
Expand Down Expand Up @@ -3632,7 +3653,7 @@
textareaDom?.setSelectionRange(2, 5);
});
const result = await page.locator('.result').first().innerText();
expect(result).toBe('2-5');

Check failure on line 3656 in packages/web-platform/web-tests/tests/react.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (Default) / check

[webkit] › tests/react.spec.ts:3642:7 › reactlynx3 tests › elements › x-textarea › basic-element-x-textarea-bindselection

4) [webkit] › tests/react.spec.ts:3642:7 › reactlynx3 tests › elements › x-textarea › basic-element-x-textarea-bindselection Error: expect(received).toBe(expected) // Object.is equality Expected: "2-5" Received: "" 3654 | }); 3655 | const result = await page.locator('.result').first().innerText(); > 3656 | expect(result).toBe('2-5'); | ^ 3657 | }, 3658 | ); 3659 | at /home/runner/_work/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:3656:26
},
);

Expand Down
Loading