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/tender-areas-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lynx-js/web-mainthread-apis": patch
---

fix: the l-p-comp-uid of page should be '1'
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ export function createMainThreadGlobalThis(
const page = __CreateElement('page', 0);
page.setAttribute('part', 'page');
page.setAttribute(cssIdAttribute, cssID + '');
page.setAttribute(parentComponentUniqueIdAttribute, '0');
page.setAttribute(parentComponentUniqueIdAttribute, '1');
page.setAttribute(componentIdAttribute, componentID);
__MarkTemplateElement(page);
if (pageConfig.defaultDisplayLinear === false) {
Expand Down

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions packages/web-platform/web-tests/tests/react.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,18 @@
); // green
},
);

test('basic-page-event', async ({ page }, { title }) => {
await goto(page, title);
const target = page.locator('#target');
await expect(target).toHaveCSS('background-color', 'rgb(255, 192, 203)'); // pink
await target.click();
await wait(100);
await expect(target).toHaveCSS(
'background-color',
'rgb(0, 128, 0)',
); // green;
});
});
test.describe('basic-css', () => {
test('basic-css-asset-in-css', async ({ page }, { title }) => {
Expand Down Expand Up @@ -1784,7 +1796,7 @@
});
await goto(page, title);
await wait(200);
!isSSR && expect(mts).toBe(true);

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

View workflow job for this annotation

GitHub Actions / Playwright MULTI_THREAD-CSR (1/4) / check

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

7) [webkit] › tests/react.spec.ts:1784:5 › reactlynx3 tests › apis › api-globalThis ────────────── Error: expect(received).toBe(expected) // Object.is equality Expected: true Received: false 1797 | await goto(page, title); 1798 | await wait(200); > 1799 | !isSSR && expect(mts).toBe(true); | ^ 1800 | expect(bts).toBe(true); 1801 | }, 1802 | ); at /__w/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:1799:31
expect(bts).toBe(true);
},
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2023 The Lynx Authors. All rights reserved.
// Licensed under the Apache License Version 2.0 that can be found in the
// LICENSE file in the root directory of this source tree.
import { root, useState } from '@lynx-js/react';
function App() {
const [color, setColor] = useState('pink');
const handleTap = () => {
setColor('green');
};

return (
<page
bindtap={handleTap}
>
<view
id='target'
style={{ width: '100px', height: '100px', backgroundColor: color }}
>
</view>
</page>
);
}
root.render(
<App></App>,
);
Loading