Don't avoid to execute the Blur callback when blurring a text field (bug 1863910)
This commit is contained in:
		
							parent
							
								
									42f3d57365
								
							
						
					
					
						commit
						ec396c2150
					
				| @ -1288,7 +1288,9 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement { | |||||||
|           } |           } | ||||||
|           elementData.lastCommittedValue = target.value; |           elementData.lastCommittedValue = target.value; | ||||||
|           elementData.commitKey = 1; |           elementData.commitKey = 1; | ||||||
|  |           if (!this.data.actions?.Focus) { | ||||||
|             elementData.focused = true; |             elementData.focused = true; | ||||||
|  |           } | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         element.addEventListener("updatefromsandbox", jsEvent => { |         element.addEventListener("updatefromsandbox", jsEvent => { | ||||||
| @ -1397,7 +1399,9 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement { | |||||||
|           if (!elementData.focused || !event.relatedTarget) { |           if (!elementData.focused || !event.relatedTarget) { | ||||||
|             return; |             return; | ||||||
|           } |           } | ||||||
|  |           if (!this.data.actions?.Blur) { | ||||||
|             elementData.focused = false; |             elementData.focused = false; | ||||||
|  |           } | ||||||
|           const { value } = event.target; |           const { value } = event.target; | ||||||
|           elementData.userValue = value; |           elementData.userValue = value; | ||||||
|           if (elementData.lastCommittedValue !== value) { |           if (elementData.lastCommittedValue !== value) { | ||||||
|  | |||||||
| @ -2183,4 +2183,46 @@ describe("Interaction", () => { | |||||||
|       ); |       ); | ||||||
|     }); |     }); | ||||||
|   }); |   }); | ||||||
|  | 
 | ||||||
|  |   describe("Textfield with a Blur callback", () => { | ||||||
|  |     let pages; | ||||||
|  |     let otherPages; | ||||||
|  | 
 | ||||||
|  |     beforeAll(async () => { | ||||||
|  |       otherPages = await Promise.all( | ||||||
|  |         global.integrationSessions.map(async session => | ||||||
|  |           session.browser.newPage() | ||||||
|  |         ) | ||||||
|  |       ); | ||||||
|  |       pages = await loadAndWait("bug1863910.pdf", getSelector("25R")); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     afterAll(async () => { | ||||||
|  |       await closePages(pages); | ||||||
|  |       await Promise.all(otherPages.map(page => page.close())); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     it("must check that blur callback is called", async () => { | ||||||
|  |       await Promise.all( | ||||||
|  |         pages.map(async ([browserName, page], i) => { | ||||||
|  |           await page.waitForFunction( | ||||||
|  |             "window.PDFViewerApplication.scriptingReady === true" | ||||||
|  |           ); | ||||||
|  | 
 | ||||||
|  |           await page.click(getSelector("25R")); | ||||||
|  |           await page.waitForTimeout(10); | ||||||
|  |           await page.click(getSelector("26R")); | ||||||
|  | 
 | ||||||
|  |           await page.waitForFunction( | ||||||
|  |             sel => document.querySelector(sel).value !== "", | ||||||
|  |             {}, | ||||||
|  |             getSelector("26R") | ||||||
|  |           ); | ||||||
|  | 
 | ||||||
|  |           const text = await page.$eval(getSelector("26R"), el => el.value); | ||||||
|  |           expect(text).withContext(`In ${browserName}`).toEqual("hello"); | ||||||
|  |         }) | ||||||
|  |       ); | ||||||
|  |     }); | ||||||
|  |   }); | ||||||
| }); | }); | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								test/pdfs/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								test/pdfs/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -618,4 +618,4 @@ | |||||||
| !issue17065.pdf | !issue17065.pdf | ||||||
| !issue17069.pdf | !issue17069.pdf | ||||||
| !issue17215.pdf | !issue17215.pdf | ||||||
| 
 | !bug1863910.pdf | ||||||
|  | |||||||
							
								
								
									
										
											BIN
										
									
								
								test/pdfs/bug1863910.pdf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								test/pdfs/bug1863910.pdf
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user