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
7 changes: 7 additions & 0 deletions .changeset/thin-poems-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@lynx-js/web-elements": patch
---

fix: the `\n` character should create a new line

add `white-space-collapse: preserve-breaks` to raw-text
1 change: 1 addition & 0 deletions packages/web-platform/web-elements/src/XText/x-text.css
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ x-text[text-maxline][tail-color-convert="false"]::part(inner-box) {

raw-text {
display: none;
white-space-collapse: preserve-breaks;
}
x-text > raw-text,
inline-text > raw-text,
Expand Down
17 changes: 13 additions & 4 deletions packages/web-platform/web-tests/tests/react.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

const expectHasText = async (page: Page, text: string) => {
const hasText = (await page.getByText(text).count()) === 1;
await expect(hasText).toBe(true);

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

View workflow job for this annotation

GitHub Actions / playwright-linux / check

[webkit] › tests/react.spec.ts:104:5 › reactlynx3 tests › basic › basic-setstate-in-constructor

3) [webkit] › tests/react.spec.ts:104:5 › reactlynx3 tests › basic › basic-setstate-in-constructor Error: expect(received).toBe(expected) // Object.is equality Expected: true Received: false 35 | const expectHasText = async (page: Page, text: string) => { 36 | const hasText = (await page.getByText(text).count()) === 1; > 37 | await expect(hasText).toBe(true); | ^ 38 | }; 39 | 40 | const expectNoText = async (page: Page, text: string) => { at expectHasText (/home/runner/_work/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:37:25) at /home/runner/_work/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:107:7
};

const expectNoText = async (page: Page, text: string) => {
Expand Down Expand Up @@ -79,7 +79,7 @@
await wait(100);
const target = page.locator('#target');
await target.click();
await expect(await target.getAttribute('style')).toContain('green');

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

View workflow job for this annotation

GitHub Actions / playwright-linux / check

[webkit] › tests/react.spec.ts:77:5 › reactlynx3 tests › basic › basic-bindtap

2) [webkit] › tests/react.spec.ts:77:5 › reactlynx3 tests › basic › basic-bindtap ──────────────── Error: expect(received).toContain(expected) // indexOf Expected substring: "green" Received string: "height: 100px; width: 100px; background: pink;" 80 | const target = page.locator('#target'); 81 | await target.click(); > 82 | await expect(await target.getAttribute('style')).toContain('green'); | ^ 83 | await target.click(); 84 | await expect(await target.getAttribute('style')).toContain('pink'); 85 | }); at /home/runner/_work/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:82:56
await target.click();
await expect(await target.getAttribute('style')).toContain('pink');
});
Expand Down Expand Up @@ -793,7 +793,7 @@
globalThis.lynxView.sendGlobalEvent('event-test', ['change']);
});
await wait(100);
await expect(target).toHaveCSS(

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

View workflow job for this annotation

GitHub Actions / playwright-linux / check

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

4) [webkit] › tests/react.spec.ts:787:5 › reactlynx3 tests › apis › api-sendGlobalEvent ────────── Error: Timed out 5000ms waiting for expect(locator).toHaveCSS(expected) Locator: locator('#target') Expected string: "rgb(0, 128, 0)" Received string: "rgb(255, 192, 203)" Call log: - expect.toHaveCSS with timeout 5000ms - waiting for locator('#target') 9 × locator resolved to <x-view id="target" lynx-tag="view" lynx-unique-id="2"></x-view> - unexpected value "rgb(255, 192, 203)" 794 | }); 795 | await wait(100); > 796 | await expect(target).toHaveCSS( | ^ 797 | 'background-color', 798 | 'rgb(0, 128, 0)', 799 | ); // green; at /home/runner/_work/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:796:28

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

View workflow job for this annotation

GitHub Actions / playwright-linux / check

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

4) [webkit] › tests/react.spec.ts:787:5 › reactlynx3 tests › apis › api-sendGlobalEvent ────────── Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toHaveCSS(expected) Locator: locator('#target') Expected string: "rgb(0, 128, 0)" Received string: "rgb(255, 192, 203)" Call log: - expect.toHaveCSS with timeout 5000ms - waiting for locator('#target') 9 × locator resolved to <x-view id="target" lynx-tag="view" lynx-unique-id="2"></x-view> - unexpected value "rgb(255, 192, 203)" 794 | }); 795 | await wait(100); > 796 | await expect(target).toHaveCSS( | ^ 797 | 'background-color', 798 | 'rgb(0, 128, 0)', 799 | ); // green; at /home/runner/_work/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:796:28

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

View workflow job for this annotation

GitHub Actions / playwright-linux / check

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

4) [webkit] › tests/react.spec.ts:787:5 › reactlynx3 tests › apis › api-sendGlobalEvent ────────── Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toHaveCSS(expected) Locator: locator('#target') Expected string: "rgb(0, 128, 0)" Received string: "rgb(255, 192, 203)" Call log: - expect.toHaveCSS with timeout 5000ms - waiting for locator('#target') 9 × locator resolved to <x-view id="target" lynx-tag="view" lynx-unique-id="2"></x-view> - unexpected value "rgb(255, 192, 203)" 794 | }); 795 | await wait(100); > 796 | await expect(target).toHaveCSS( | ^ 797 | 'background-color', 798 | 'rgb(0, 128, 0)', 799 | ); // green; at /home/runner/_work/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:796:28

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

View workflow job for this annotation

GitHub Actions / playwright-linux / check

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

7) [chromium] › tests/react.spec.ts:787:5 › reactlynx3 tests › apis › api-sendGlobalEvent ──────── Error: Timed out 5000ms waiting for expect(locator).toHaveCSS(expected) Locator: locator('#target') Expected string: "rgb(0, 128, 0)" Received string: "rgb(255, 192, 203)" Call log: - expect.toHaveCSS with timeout 5000ms - waiting for locator('#target') 9 × locator resolved to <x-view id="target" lynx-tag="view" lynx-unique-id="2"></x-view> - unexpected value "rgb(255, 192, 203)" 794 | }); 795 | await wait(100); > 796 | await expect(target).toHaveCSS( | ^ 797 | 'background-color', 798 | 'rgb(0, 128, 0)', 799 | ); // green; at /home/runner/_work/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:796:28
'background-color',
'rgb(0, 128, 0)',
); // green;
Expand Down Expand Up @@ -994,7 +994,7 @@
await wait(100);
const target = page.locator('#target');
await target.click();
await expect(await target.getAttribute('style')).toContain('green');

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

View workflow job for this annotation

GitHub Actions / playwright-linux / check

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

5) [webkit] › tests/react.spec.ts:992:5 › reactlynx3 tests › configs › config-mode-dev-with-all-in-one Error: expect(received).toContain(expected) // indexOf Expected substring: "green" Received string: "height: 100px; width: 100px; background: pink;" 995 | const target = page.locator('#target'); 996 | await target.click(); > 997 | await expect(await target.getAttribute('style')).toContain('green'); | ^ 998 | await target.click(); 999 | await expect(await target.getAttribute('style')).toContain('pink'); 1000 | }); at /home/runner/_work/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:997:56
await target.click();
await expect(await target.getAttribute('style')).toContain('pink');
});
Expand Down Expand Up @@ -1081,16 +1081,21 @@
);
},
);
test('basic-element-text-with-new-line', async ({ page }, { title }) => {
await goto(page, title);
await wait(100);
await diffScreenShot(page, 'text', 'raw-text-new-line');
});
test.describe('basic-element-text-text-selection', () => {
const title = 'basic-element-text-text-selection';

test('selection-true-boolean-flatten-false', async ({ page, browserName }) => {
await goto(page, title);
if (browserName === 'webkit') {
await page
.getByText('text-selection-true-boolean-flatten-false')
.first()
.click({ 'clickCount': 3 });
test.skip(
true,
'the selection status cannot be screenshot on webkit',
);
} else {
await page
.getByText('text-selection-true-boolean-flatten-false')
Expand All @@ -1103,6 +1108,10 @@
'text',
'text-selection',
'text-selection-true-boolean-flatten-false',
{
threshold: 0.1,
fullPage: false,
},
);
});

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// 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 } from '@lynx-js/react';
function App() {
return (
<view>
<text>
{`hello\nworld!`}
</text>
</view>
);
}
root.render(<App></App>);
Loading