test(e2e): addressing #3440 related case on macOS

pull/4789/head
Junyi Du 2022-03-08 01:33:22 +08:00 committed by Tienson Qin
parent 2cfa95d17b
commit a520781503
2 changed files with 126 additions and 57 deletions

View File

@ -7,7 +7,7 @@ import * as kb_events from './util/keyboard-events'
test(
"press Chinese parenthesis 【 by 2 times #3251 should trigger [[]], " +
"but dont trigger RIME #3440 ",
// cases should trigger [[]]
// cases should trigger [[]] #3251
async ({ page }) => {
for (let left_full_bracket of [
kb_events.macos_pinyin_left_full_bracket,
@ -22,16 +22,22 @@ test(
await page.type(':nth-match(textarea, 1)', "【")
await dispatch_kb_events(page, ':nth-match(textarea, 1)', left_full_bracket)
expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('[[]]')
}
};
// cases should NOT trigger [[]]
// dont trigger RIME #3440
for (let [idx, selecting_candidate_left_bracket] of [
kb_events.macos_pinyin_selecting_candidate_left_bracket,
kb_events.win10_RIME_selecting_candidate_left_bracket
].entries()) {
await createRandomPage(page)
let prefix = "#3440 test " + idx + ": "
await page.type(':nth-match(textarea, 1)', prefix + "【")
await dispatch_kb_events(page, ':nth-match(textarea, 1)', selecting_candidate_left_bracket)
expect(await page.inputValue(':nth-match(textarea, 1)')).toBe(prefix + '【')
await page.type(':nth-match(textarea, 1)', "【")
await dispatch_kb_events(page, ':nth-match(textarea, 1)', kb_events.win10_RIME_left_full_bracket)
expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('【')
await page.type(':nth-match(textarea, 1)', "【")
await dispatch_kb_events(page, ':nth-match(textarea, 1)', kb_events.win10_RIME_left_full_bracket)
expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('【【')
await dispatch_kb_events(page, ':nth-match(textarea, 1)', selecting_candidate_left_bracket)
expect(await page.inputValue(':nth-match(textarea, 1)')).toBe(prefix + '【【')
}
})
test('hashtag and quare brackets in same line #4178', async ({ page }) => {

View File

@ -123,12 +123,12 @@ export let win10_legacy_pinyin_left_full_bracket = [
}
]
export let win10_RIME_left_full_bracket = [
export let macos_pinyin_selecting_candidate_left_bracket = [
{
"event_type": "keydown",
"event": {
"key": "Process",
"code": "BracketLeft",
"key": "a",
"code": "KeyA",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
@ -142,23 +142,8 @@ export let win10_RIME_left_full_bracket = [
{
"event_type": "keyup",
"event": {
"key": "Process",
"code": "BracketLeft",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": true,
"composed": true
}
},
{
"event_type": "keyup",
"event": {
"key": "[",
"code": "BracketLeft",
"key": "a",
"code": "KeyA",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
@ -172,7 +157,7 @@ export let win10_RIME_left_full_bracket = [
{
"event_type": "keydown",
"event": {
"key": "Process",
"key": "",
"code": "BracketLeft",
"location": 0,
"ctrlKey": false,
@ -187,7 +172,145 @@ export let win10_RIME_left_full_bracket = [
{
"event_type": "keyup",
"event": {
"key": "Process",
"key": "【",
"code": "BracketLeft",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": true,
"composed": true
}
}
]
export let win10_RIME_selecting_candidate_left_bracket = [
{
"event_type": "keydown",
"event": {
"key": "Process",
"code": "KeyA",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": false,
"composed": true
}
},
{
"event_type": "keyup",
"event": {
"key": "Process",
"code": "KeyA",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": true,
"composed": true
}
},
{
"event_type": "keyup",
"event": {
"key": "a",
"code": "KeyA",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": true,
"composed": true
}
},
{
"event_type": "keydown",
"event": {
"key": "Process",
"code": "BracketLeft",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": true,
"composed": true
}
},
{
"event_type": "keyup",
"event": {
"key": "Process",
"code": "BracketLeft",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": true,
"composed": true
}
},
{
"event_type": "keyup",
"event": {
"key": "[",
"code": "BracketLeft",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": true,
"composed": true
}
},
{
"event_type": "keydown",
"event": {
"key": "Process",
"code": "BracketLeft",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": true,
"composed": true
}
},
{
"event_type": "keyup",
"event": {
"key": "Process",
"code": "BracketLeft",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": true,
"composed": true
}
},
{
"event_type": "keyup",
"event": {
"key": "[",
"code": "BracketLeft",
"location": 0,
"ctrlKey": false,
@ -198,65 +321,5 @@ export let win10_RIME_left_full_bracket = [
"isComposing": true,
"composed": true
}
},
{
"event_type": "keyup",
"event": {
"key": "[",
"code": "BracketLeft",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": true,
"composed": true
}
},
{
"event_type": "keydown",
"event": {
"key": "Process",
"code": "Space",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": true,
"composed": true
}
},
{
"event_type": "keyup",
"event": {
"key": "Process",
"code": "Space",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": false,
"composed": true
}
},
{
"event_type": "keyup",
"event": {
"key": " ",
"code": "Space",
"location": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"repeat": false,
"isComposing": false,
"composed": true
}
}
]