mirror of
				https://github.com/bigskysoftware/htmx.git
				synced 2025-10-31 05:23:12 +00:00 
			
		
		
		
	add test to ensure I don't screw up the sameHost value
				
					
				
			This commit is contained in:
		
							parent
							
								
									193cb67393
								
							
						
					
					
						commit
						1acbbe5057
					
				| @ -142,7 +142,25 @@ describe("security options", function() { | |||||||
|             htmx.off("htmx:validateUrl", pathVerifier); |             htmx.off("htmx:validateUrl", pathVerifier); | ||||||
|         }) |         }) | ||||||
|         var listener = htmx.on("htmx:invalidPath", function (){ |         var listener = htmx.on("htmx:invalidPath", function (){ | ||||||
|             htmx.config.selfRequestsOnly = false; |             htmx.off("htmx:invalidPath", listener); | ||||||
|  |             done(); | ||||||
|  |         }) | ||||||
|  |         this.server.restore(); // use real xhrs
 | ||||||
|  |         // will 404, but should respond
 | ||||||
|  |         var btn = make('<button hx-get="https://hypermedia.systems/www/test">Initial</button>') | ||||||
|  |         btn.click(); | ||||||
|  |     }) | ||||||
|  | 
 | ||||||
|  |     it("can cancel egress request based on htmx:validateUrl event, sameHost is false", function(done){ | ||||||
|  |         htmx.logAll() | ||||||
|  |         // should trigger send error, rather than reject
 | ||||||
|  |         var pathVerifier = htmx.on("htmx:validateUrl", function (evt){ | ||||||
|  |             if (evt.detail.sameHost === false) { | ||||||
|  |                 evt.preventDefault(); | ||||||
|  |             } | ||||||
|  |             htmx.off("htmx:validateUrl", pathVerifier); | ||||||
|  |         }) | ||||||
|  |         var listener = htmx.on("htmx:invalidPath", function (){ | ||||||
|             htmx.off("htmx:invalidPath", listener); |             htmx.off("htmx:invalidPath", listener); | ||||||
|             done(); |             done(); | ||||||
|         }) |         }) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Carson Gross
						Carson Gross