mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 17:46:32 -04:00
add test for History URL updating
This commit is contained in:
19
src/browser/tests/history_url_update.html
Normal file
19
src/browser/tests/history_url_update.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="testing.js"></script>
|
||||
|
||||
<script id=url_updates>
|
||||
{
|
||||
const originalUrl = location.href;
|
||||
|
||||
// pushState updates the URL
|
||||
history.pushState(null, '', '/test-push-path');
|
||||
testing.expectEqual('/test-push-path', location.pathname);
|
||||
|
||||
// replaceState updates the URL
|
||||
history.replaceState(null, '', '/test-replace-path');
|
||||
testing.expectEqual('/test-replace-path', location.pathname);
|
||||
|
||||
// Restore original URL so other tests aren't affected
|
||||
history.replaceState(null, '', originalUrl);
|
||||
}
|
||||
</script>
|
||||
@@ -138,4 +138,5 @@ pub const JsApi = struct {
|
||||
const testing = @import("../../testing.zig");
|
||||
test "WebApi: History" {
|
||||
try testing.htmlRunner("history.html", .{});
|
||||
try testing.htmlRunner("history_url_update.html", .{});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user