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/light-actors-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@lynx-js/web-core-server": patch
"@lynx-js/web-core": patch
"@lynx-js/web-explorer": patch
---

feat: builtinTagTransformMap add `'x-input-ng': 'x-input'`
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const builtinTagTransformMap = {
'list': 'x-list',
'svg': 'x-svg',
'input': 'x-input',
'x-input-ng': 'x-input',
};

// @ts-expect-error
Expand Down
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 @@ -421,6 +421,7 @@ export class LynxView extends HTMLElement {
'list': 'x-list',
'svg': 'x-svg',
'input': 'x-input',
'x-input-ng': 'x-input',
...this.overrideLynxTagToHTMLTagMap,
};
if (!this.shadowRoot) {
Expand Down
13 changes: 13 additions & 0 deletions packages/web-platform/web-tests/tests/react.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3024,6 +3024,19 @@
const result = await page.locator('.result').first().innerText();
expect(result).toBe('foobar-6-6');
});
// input/bindinput test-case start for <x-input-ng>
test(
'basic-element-x-input-ng-bindinput',
async ({ page }, { title }) => {
await goto(page, title);
await page.locator('input').press('Enter');
await wait(200);
await page.locator('input').fill('foobar');
await wait(200);
const result = await page.locator('.result').first().innerText();
expect(result).toBe('foobar-6-6');
},
);
// input/bindinput test-case end
test(
'basic-element-x-input-getValue',
Expand Down Expand Up @@ -3076,7 +3089,7 @@
inputDom?.setSelectionRange(2, 5);
});
const result = await page.locator('.result').first().innerText();
expect(result).toBe('2-5');

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

View workflow job for this annotation

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

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

2) [chromium] › tests/react.spec.ts:3080:7 › reactlynx3 tests › elements › x-input › basic-element-x-input-bindselection Error: expect(received).toBe(expected) // Object.is equality Expected: "2-5" Received: "" 3090 | }); 3091 | const result = await page.locator('.result').first().innerText(); > 3092 | expect(result).toBe('2-5'); | ^ 3093 | }, 3094 | ); 3095 | test( at /__w/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:3092:26
},
);
test(
Expand Down Expand Up @@ -4446,7 +4459,7 @@
textareaDom?.setSelectionRange(2, 5);
});
const result = await page.locator('.result').first().innerText();
expect(result).toBe('2-5');

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

View workflow job for this annotation

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

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

3) [chromium] › tests/react.spec.ts:4448:7 › reactlynx3 tests › elements › x-textarea › basic-element-x-textarea-bindselection Error: expect(received).toBe(expected) // Object.is equality Expected: "2-5" Received: "" 4460 | }); 4461 | const result = await page.locator('.result').first().innerText(); > 4462 | expect(result).toBe('2-5'); | ^ 4463 | }, 4464 | ); 4465 | at /__w/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:4462:26
},
);

Expand Down Expand Up @@ -4568,7 +4581,7 @@

await goto(page, title);
await wait(5000);
expect(scrolltolower).toBeTruthy();

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

View workflow job for this annotation

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

[chromium] › tests/react.spec.ts:4568:7 › reactlynx3 tests › elements › list › basic-element-list-estimated-main-axis-size-px-waterfall

4) [chromium] › tests/react.spec.ts:4568:7 › reactlynx3 tests › elements › list › basic-element-list-estimated-main-axis-size-px-waterfall Retry #3 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(received).toBeTruthy() Received: false 4582 | await goto(page, title); 4583 | await wait(5000); > 4584 | expect(scrolltolower).toBeTruthy(); | ^ 4585 | }, 4586 | ); 4587 | test( at /__w/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:4584:33

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

View workflow job for this annotation

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

[chromium] › tests/react.spec.ts:4568:7 › reactlynx3 tests › elements › list › basic-element-list-estimated-main-axis-size-px-waterfall

4) [chromium] › tests/react.spec.ts:4568:7 › reactlynx3 tests › elements › list › basic-element-list-estimated-main-axis-size-px-waterfall Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(received).toBeTruthy() Received: false 4582 | await goto(page, title); 4583 | await wait(5000); > 4584 | expect(scrolltolower).toBeTruthy(); | ^ 4585 | }, 4586 | ); 4587 | test( at /__w/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:4584:33

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

View workflow job for this annotation

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

[chromium] › tests/react.spec.ts:4568:7 › reactlynx3 tests › elements › list › basic-element-list-estimated-main-axis-size-px-waterfall

4) [chromium] › tests/react.spec.ts:4568:7 › reactlynx3 tests › elements › list › basic-element-list-estimated-main-axis-size-px-waterfall Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(received).toBeTruthy() Received: false 4582 | await goto(page, title); 4583 | await wait(5000); > 4584 | expect(scrolltolower).toBeTruthy(); | ^ 4585 | }, 4586 | ); 4587 | test( at /__w/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:4584:33

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

View workflow job for this annotation

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

[chromium] › tests/react.spec.ts:4568:7 › reactlynx3 tests › elements › list › basic-element-list-estimated-main-axis-size-px-waterfall

4) [chromium] › tests/react.spec.ts:4568:7 › reactlynx3 tests › elements › list › basic-element-list-estimated-main-axis-size-px-waterfall Error: expect(received).toBeTruthy() Received: false 4582 | await goto(page, title); 4583 | await wait(5000); > 4584 | expect(scrolltolower).toBeTruthy(); | ^ 4585 | }, 4586 | ); 4587 | test( at /__w/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:4584:33
},
);
test(
Expand Down Expand Up @@ -4606,7 +4619,7 @@

await goto(page, title);
await wait(5000);
expect(scrolltolower).toBeTruthy();

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

View workflow job for this annotation

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

[chromium] › tests/react.spec.ts:4606:7 › reactlynx3 tests › elements › list › basic-element-list-horizontal-estimated-main-axis-size-px-waterfall

5) [chromium] › tests/react.spec.ts:4606:7 › reactlynx3 tests › elements › list › basic-element-list-horizontal-estimated-main-axis-size-px-waterfall Error: expect(received).toBeTruthy() Received: false 4620 | await goto(page, title); 4621 | await wait(5000); > 4622 | expect(scrolltolower).toBeTruthy(); | ^ 4623 | }, 4624 | ); 4625 | }); at /__w/lynx-stack/lynx-stack/packages/web-platform/web-tests/tests/react.spec.ts:4622:33
},
);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// 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 value = 'bindinput';
const [result, setResult] = useState();

const onInput = ({ detail }) => {
if (typeof detail !== 'object') {
throw new Error(
`detail type not match. expect object, got ${typeof detail}`,
);
}

const { value, cursor, textLength, selectionStart, selectionEnd } = detail;

if (value.length !== textLength) {
throw new Error(
`input length not match. expect ${textLength}, got ${value.length}`,
);
}

setResult(`${value}-${selectionStart}-${selectionStart}`);
};
Comment thread
Sherry-hue marked this conversation as resolved.

return (
<view>
<x-input-ng
bindinput={onInput}
value={value}
style='border: 1px solid;width: 300px;height:40px'
/>
<view class='result'>
<text>{result}</text>
</view>
</view>
);
}

root.render(<App></App>);
Loading